You need to sign in to do that
Don't have an account?

Duplicate Contacts on Lead Convert
I am trying to get a list of duplicate contacts on Lead Conversion. This is the trigger I have written so far.
Basically I want my duplicate contacts list to be displayed to users. Kindly suggest as it is urgent.
Thanks
trigger LeadConvert on Lead (after update) { if(trigger.new.size() > 1) return; if (trigger.old[0].isConverted == false && trigger.new[0].isConverted == true) { //Block for deduping Contacts if (Trigger.new[0].ConvertedContactId != null) { System.debug('Converted ontact Id >>> ' + Trigger.new[0].ConvertedContactId); System.debug('trigger.old[0]>>>' +trigger.old[0]); System.debug('trigger.old[0]>>>' +trigger.new[0]); List<Contact> lstDupContact = [SELECT id, firstName, lastName, email from Contact where (firstName =: Trigger.new[0].FirstName OR lastName =: Trigger.new[0].LastName) AND email =: Trigger.new[0].email]; for(Contact c: lstDupContact){ System.debug('lstDupContact >>>>' + lstDupContact); Lead oldRec = Trigger.old[0]; oldRec.Name.addError('Duplicate Contacts Found!!'); //oldRec.addError('Duplicate Contacts Found!!'); } } } }The lstDupContact now contains all duplicate contacts. How can I display this list to users? I tried displaying error message using oldRec.Name.addError('Duplicate Contacts Found!!'); but was unable to do so.
Basically I want my duplicate contacts list to be displayed to users. Kindly suggest as it is urgent.
Thanks
To display the list to the user you'd need to move this logic into a Visualforce controller and override the lead conversion, which is probably more trouble than its worth for something like this.
However, the error is always shown below the ConvertedStatus field as shown in the scheenshot attached. How can I make the error appear on top of the page instead?
Thanks In Advance.
https://developer.salesforce.com/forums/ForumsMain?id=906F000000098FfIAI#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Visualforce_Development&criteria=OPENQUESTIONS&id=906F0000000AiuWIAS