+ Start a Discussion
Patrick WongPatrick Wong 

Lead Duplicate Checking Function

Why the Duplicate Record Items Trigger can't be run while Duplicate Lead is Created?
Pritam ShekhawatPritam Shekhawat
Hello Patrick ,
                     Could you please give some more detail about your issue. Where you write trigger for duplicate check?? If possible share your code.

Anand SinghAnand Singh

With Spring 15, you can create "Duplicate Rules" and "Matching Rules". Refer below URL for details:


Patrick WongPatrick Wong
Thanks for your guys reply. I created the trigger on the DuplicateRecordItem which is the standard Duplicate checking function Object. The purpose is that I want to lookup the Lead / Account / Contact in the Duplicate Record Item. So that I can create a workflow rule to trigger the email alert to the duplicate record Item's Owner's Manager. Though there is a record field in that Object to link up to the Duplicate Record. But can't refer to the fields in it. The following is my code. But can't be triggered when I create a duplicate lead record.

trigger DuplicateRecordItemBeforeInsert on DuplicateRecordItem (before insert, before update) {
    for(DuplicateRecordItem duplicateRecordItem : trigger.new){
        System.debug('duplicateRecordItem.Record:' + duplicateRecordItem.Record);
        if (duplicateRecordItem.Record != null){
        System.debug('duplicateRecordItem.Record.getsObjectType():' + duplicateRecordItem.Record.getsObjectType());
            if (duplicateRecordItem.Record.getsObjectType() == Lead.sObjectType){
                duplicateRecordItem.Lead__c = duplicateRecordItem.RecordId;
            if (duplicateRecordItem.Record.getsObjectType() == Account.sObjectType){
                duplicateRecordItem.Account__c = duplicateRecordItem.RecordId;
            if (duplicateRecordItem.Record.getsObjectType() == Contact.sObjectType){
                duplicateRecordItem.Contact__c = duplicateRecordItem.RecordId;
Stephen Lombard 10Stephen Lombard 10
Patrick, did you get arount this. Same issue for me, Trigger does not seem to be getting called.
Sonal GuptaSonal Gupta
Hi @Patrick Wong,
I am also facing same issue, did you find any workaround/ solution ?