I have a requirement to find duplicates based on the company name matching against the account name for all the accounts when a lead will be pushed into sfdc.
So I have set up the below logic:
Datacloud.FindDuplicatesResult[] results = Datacloud.FindDuplicates.findDuplicates(leadsList);
But it's checking with all the duplicate rules on the lead object. So, I need some help on the below ones.
- Is there a way to run
findDuplicates()
to match with a specific duplicate rule(i know we can run a for loop and filter the match results. But is there any way to do it directly) - Currently returned records from the duplicate results contain's the company name, Id. So, is there a way to include custom fields in the
getRecord()
list?
(Datacloud.MatchResult[getEntityType=Contact;getErrors=();getMatchEngine=FuzzyMatchEngine;getMatchRecords=();getRule=Standard_Contact_Match_Rule_v1_1;getSize=0;isSuccess=true;],
Datacloud.MatchResult[getEntityType=Lead;getErrors=();getMatchEngine=ExactMatchEngine;getMatchRecords=();getRule=Custom_Matching_Rule_On_Lead;getSize=0;isSuccess=true;]);isAllowSave=false;],
Datacloud.DuplicateResult[getDuplicateRule=Account_Name_Match;getDuplicateRuleEntityType=Lead;getErrorMessage=Use
one of these
records?;getMatchResults=(Datacloud.MatchResult[getEntityType=Account;getErrors=();getMatchEngine=FuzzyMatchEngine;
getMatchRecords=(Datacloud.MatchRecord[getAdditionalInformation=();getFieldDiffs=(Datacloud.FieldDiff[getDifference=Different;getName=Name;]);getMatchConfidence=100.0;
getRecord=Account:{BillingAddress=null, Id=0013C00000aAyicQAC,
Name=Disney
Inc.};]);getRule=Account_Name_Match;getSize=1;isSuccess=true;]);isAllowSave=false;]);getErrors=();isSuccess=true;])