• Karthik Reddy 6
  • 0 Points
  • Member since 2015

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 2

While capturing a lead by Lead Capture Form we are checking whether Lead exists in existing accounts data. For this we are reducing the Lead compnay name by exluding few keywords (Inc, Technology, Llc etc) and then searching it in Accounts using like query.

e.g. Compnay name of inserted Lead is "Macro Tech Inc" then reduced compnay name is "macro" and SOQL query is "Select Id from Account where Name Like '%macro%'". Query returns these 2 companies - Macronetics and Macro Technology. Our code then picks first compnay i.e. Macronatics. Which is wrong, 'Macro Tech Inc' and 'Macronetics' are different companies. So there is requirement to search by whole work. %macro% returns all Acounts where the string is a substring of any account name.

Please help in writing the query to get accounts where I can search by whole word to find near match. Or do you have any better idea to search for near match of account?