Handling Duplicates in the Lightning Experience in Salesforce
Merge Contacts and Merge Account List Buttons as It Is in the Salesforce Classic vs Potential Duplicates Component in Lightning Experience
Despite the fact that the Lightning Experience provides a bigger experience in Salesforce, many individuals still favor Salesforce Classic. One of the key reasons is the change in how various features are handled, which is quite known due to the long-term use of Salesforce Classic.
People simply miss how easy it was to operate in Salesforce Classic and have been unable to adapt to the new Lightning Experience versions.
We’ve seen some features that could be obtained in Lightning Experience as it is Classic in previous articles.
- Open Activity and Activity History in Lightning Experience Salesforce
- Phone and Email on Tasks or Events in Lightning Experience
In this article, we’ll look at something that can be altered in Lightning Experience just like it can in Salesforce Classic, as well as how it behaves in Lightning Experience.
Merge Duplicate Contacts in Lightning Experience using Merge Contacts List Button
Today, we’ll go over a short and easy hack that will allow us to merge accounts and contacts in Lightning in the same way we do in Salesforce Classic.
In Lightning, the merging of records works a little differently than in Classic. The merging of records in Lightning is based on duplicates. So, if two records are duplicates (as determined by the ‘Potential Duplicates’, a LEX component), you may use the Potential Duplicates component to merge them.
This is not the case in classic, because you can merge two records even if they are not duplicates.
Now that we’ve established the distinction, let’s look at how we might use Lightning’s Classic merge capabilities. A URL-based custom button will be used to solve our problem.
Let’s see how it is in the Salesforce Classic first.
When we click it, we can see the following User Interface.
In Lightning,
If we check the Page Layout of the Account, we can see that the Merge Contact is enabled which is not populating in the Lightning Record Pages.
So how to implement it?
The button has to be populated in the Contact Records. So, we’ve to create Merge Contacts, a List Button in Contact Standard Object.
- Go to Object Manager
2. Select Contacts > Buttons, Links, and Actions > New Button or Link
Select the rest of the options as follows and for the URL, paste it
/merge/conmergewizard.jsp?id={!Account.Id}&retURL=/{!Account.Id}
After that, add that button to the Search Layout in Contacts.
In Salesforce, a search layout is an ordered group of fields that appear when a record is displayed in a certain context, such as search results, a lookup dialog, or a related list.
Now, check the Page Layout once again and select the Related List Properties of Contacts.
There, you can see the newly created Custom Button. Bring it to the other side (Selected Buttons). Save it.
When we click it, we can see the following User Interface.
Well, we’ve made it. Here, we’ve added the Merge Contacts button on the Related List of Account Record Page.
Similarly, we can add the Merge Accounts button as needed. For that, you may have to follow the same steps and you’ve to use the following URL for it.
/merge/accmergewizard.jsp?retURL=/001
Understanding the Potential Duplicates Lightning Component
Standard duplication rules and the Potential Duplicates component are set up and activated for business accounts, contacts, and leads in orgs created after Summer ’17. Person accounts must first be enabled before duplicate rules and the Potential Duplicates component may be used. Then turn on the person account matching and duplicate rules, as well as the Potential Duplicates component in your person account layout.
The Duplicate Rules that have been activated on the object are used to find potential duplicates. They generate results using matching rule approaches and activated Duplicate Rules.
Let’s see how this is achieved.
Add Potential Duplicate Component in the Lightning Record Page as follows.
You can’t add the Potential Duplicates component to custom objects. However, you can create rules to handle custom-object records that duplicate an account, contact, or lead.
Go to Matching Rules in the Setup and Activate Standard Contact Matching Rule.
Go to Duplicate Rules and create a new rule on Contacts based on the Standard Contact Matching Rule as follows.
Then create a new contact as it is already there, that is; with the same First Name, Last Name, and Email.
Close the alert and click Save again.
Now click that particular Contact record. So here, you can see that the Potential Duplicates component has identified the duplicate and informed us.
When you click View Duplicates, you can see this User Interface.
Select both and you can see the Next button will get enabled.
You can choose which record to be used to merge like this.
Confirm the Merge.
Now, it’s merged.
If you check that Account record again, you can see only one contact there.
This is how the Duplicates are handled in Lightning. Much Exciting isn’t it?
So, now tell me, you need to have the Classic feature in Lightning Record Page? or are willing to use what is assigned for Lightning Experience.
The choice is yours!
Hope this article can help. Share your thoughts too.