function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RadagastRadagast 

Controlling merging leads (preserving certain records by default)

Hey Everyone --
 
We have an external application which relies on there always being one Lead or Contact record for each of its users. If a user's record is deleted in SFDC, it causes problems with that user's access to the external app. Because the external app is what creates the majority of SFDC Leads and Contacts for us, we are able to reduce duplicates. However, occasionally we will import leads from third parties via the Import Wizard or Data Loader, so we will end up with duplicates (that is, leads that have the same email address as registered users from our external app). The existence of duplicates in itself does not cause a problem, but when one of our SFDC users does a Find Duplicates and Merge through the UI, the potential exists for the Lead that is critical to the external app to be deleted (that is, if it is not selected as the master record).
 
We are trying to eliminate the possibility of this procedural error, but our developer is having trouble. Due to a language barrier, I am posting this message on his behalf. According to him:
 
"I still trying to find the better way how SalesForce can automatically prevent wrong operations (merging DB added -> Manually added). But it seems like SalesForce person will need to control the process by himself. The problem – Lead have not trigger for OnMerge event. When Leads are merging the two events will be raised and associated triggers will be executed: OnDelete (for non Master Leads) and OnUpdate (for Master Lead) and only one place where I can do something related to merging: in OnAfterDelete trigger MasterRecordId field of deleted Leads setting up to master Lead’s ID. So, I can load master Lead and compare values of some fields of master Lead and deleted Lead. But it does not give a guarantee that values of important fields (VisitorId, VisitorStatus for example) will not be changed. Maybe you can ask someone in SalesForce how we can control merging process? Triggers cannot give us necessary flexibility or I just cannot find the way."
 
Have any of you had experience with controlling the merge interface, and so you know of a way that it can be controlled so a specific record is always the master record, and certain of its field values can never be overwritten (i.e., the user would be unable to select corresponding fields on the other leads to appear on the final merged lead)?
 
Thanks
dev_jhdev_jh

An idea: Are those duplicates enriching somehow your existing leads / contacts? If not, maybe you should consider not loading them by filtering before the upload. Regards,

 

J

Rahul_sgRahul_sg

Not sure whether your issue is resolved or not...but you can overwrite the Find Duplicates button with visualforce page and build your own merge logic/page.

 

Thanks,

Rahul