public static List<Account> findCandidates(String potentialName){
if (String.isBlank(potentialName)) return null;
List<Account> candidates = [SELECT Id FROM Account WHERE Name = :potentialName];
if (!candidates.isEmpty()) return candidates;
List<String> partialMatches = new List<String>();
for (String fragment : potentialName.split(' ')){
partialMatches.add('%' + fragment + '%');
}
return [SELECT Id FROM Account WHERE Name LIKE :partialMatches];
}
SOQL: Bulk Fuzzy Searching salesforce
Subscribe to:
Post Comments (Atom)
Featured
What is Cryptography in salesforce and what are all the algorithms provided by them ?
A). It is a security protocal between two systems. Lets say we are integration two systems without any encrytion mechanism then hackers wil...
Popular
-
Apex Snippet : ----------------- Schema.DescribeSObjectResult[] descResult = Schema.describeSObjects(new String[]{'Lead'}); ...
-
A). It is a security protocal between two systems. Lets say we are integration two systems without any encrytion mechanism then hackers wil...
-
Child Component Code Snippet : AuraMethodChildCMP.cmp <aura:component implements="force:appHostable,flexipage:availableForAllPag...
No comments:
Post a Comment