Salesforce Certified Advanced Administrator – Data Management Part 3
May 17, 2023

5. Creating a Duplicate Rule and Matching Rule

To duplicate rules and select to create a new rule. You can do duplicate rules on these objects here. Now we’ve got some custom objects such as room and room assignment and employee assignment and building for example. But then the standard objects that are available, at least for now, are account contact and leads. Let’s do another account duplicate rule. And so what we need in order to create the duplicate rule is that we can either associate this with the standard account matching rule or create a new matching rule that this duplicate rule will house or contain.

So let’s create a new matching rule. And I need to fill in some data before I can say that though it’s going to error out. So let’s just say that we give this a rule name and let’s bypass sharing rules so that this duplicate rule can see all data and not just for the specific user and then for the actions we’re going to allow on create or edit. And we’re going to alert the user and report these potential duplicates and keep the default for the alert text.

We’ll compare accounts with accounts and then click add rule or let’s remove that rule actually. So let’s go ahead and save this duplicate rule. But I want to mention these conditions though you can optionally specify the conditions that a record must meet for the rule to run. So you could have this duplicate rule only run for non admins, much like how we had validation rule previously set to only trigger for nonadmins or for admins specifying on profile.

So you could have a condition so that only for users where their profile is not equal to system administrator, for example. So let’s go ahead and save this duplicate rule. But before I do that, since I am a system administrator and I do want to create some duplicate record sets, let’s go ahead and make this equal system administrator so that this duplicate rule will only fire whenever the current user has a profile of system administrator.

So let’s click save. So now we’ve got to create the matching rule that this duplicate rule will house. And so that’s the next step. It’s a two step process, duplicate rule and then matching rule. So we configure the matching rule and it’s pulling in the rule name based on the duplicate rule name, which I called account dupe and this is called account dupe matching. Now the matching criteria, this is where we look at the fields and we determine if this is a potential duplicate or not. So you can select account fields and these will vary.

There’s so many different options here, but the main matching methods are either exact or fuzzy generally. Now fuzzy matching, there’s all sorts of different algorithms that salesforce uses behind the scenes and you don’t have control over which ones they use or not. And there’s a certain threshold as to where fuzzy matching will pull up a potential duplicate or not. And then as well to further complicate things, you can match blank fields so that if a field is blank on both records, then it will evaluate true and it’ll say this is a potential duplicate.

So for example, and this is an easy way to alert on false duplicates. For example, if you have a lot of records that don’t have, for example, a fax number and then you’re doing an exact match on that fax number, but then you say match blank fields, then if both account records have a blank fax number, it’s going to say this is a potential duplicate. So you want to be careful with your matching of blank fields. And then as well, the filter logic defaults to ends and so you can have multiple fields that you’re looking at. So saying that, okay, the account name is a fuzzy match between the existing record and the new record. And if the account source is exact and some of these are only provide exact and others provide fuzzy. And if the billing city is fuzzy and you can go on and on and on here it’s a parent account is exact. And then you can add filter logic.

And this is much like with a workflow rule or other areas in salesforce where you create filter logic. You can do and you can do ores and any number of scenarios where you can build these out. So for example, you could do one and two or three and four so that if one and two match, or if three and four match, then fire this rule. For example, I’m going to just leave these all as an and click save. And so now we’ve created our duplicate rule on our matching rule, but we’ve not activated them. So now if we click activate, we’ve now activated the matching rule. But then you’ve got to remember to activate the duplicate rule that is housing this matching rule.

So if we go into account dupe, which is our custom duplicate rule that we created, we need to activate that as well. I mentioned as well that I wanted to show about the order sequence of these duplicate rules. You can evaluate these duplicate rules in a certain order and reorder them. And so you click reorder and you can say I want to evaluate my new rule before the second one. And so there are scenarios to where you may need to reorder these. And I’ve had to do this as well. And as you get into and I just reordered that with my custom one at the top here.

And if there’s no potential duplicates through the first rule, then it looks for any subsequent rules in order based on the order number for any active duplicate rules to see if there’s potential duplicates. Now, so far we’ve created a couple of we’ve created a duplicate rule and we’ve got our standard duplicate rule. But what does this mean for the end user. What does that user interface look like? So in the next lesson, I want to show you how to show potential duplicates to your user inside of lighting experience. And there’s a potential duplicate component. We will add that in and then we’ll look at the duplicate record sets that are generated whenever we do warn users about potential duplicates. So let’s do that in the next.

6. Adding the Potential Duplicates Lightning Component to a Detail Page

We’re going to dive into how to show users potential duplicates inside the interface. A couple of things to note is that as you activate your matching rules and duplicate rules that you’ve created, you’ll receive email alerts on that. So check your inbox. You may see some emails there for that. Also I wanted to note that you can view account hierarchy not only from the button here on an account and selecting view hierarchy, but you can also if you have an account hierarchy in place, you can click on view hierarchy icon here and that will also take you to the account hierarchy for accounts and their account hierarchy. Now, I want to create a new account that’s called Burlington Textile Global. And I want to show you how, if we do that currently by going to New Account. So as I type, there’s no warning here about this being a potential duplicate record. And I’m going to also paste in the billing zip. That is the same zip code that I have for Burlington Textile Global.

I’m trying to have this be a real duplicate record here. Now, you do see as I started filling in more data, you see the record you’re about to create looks like a duplicate. Open an existing record instead. So if we click View Duplicates, we have the one potential duplicate record. Now, we could open this account and decide, oh, this is the account I’m looking for. I didn’t mean to create that. Or because we just warned the user from our duplicate rules, it will allow us to create this new duplicate record. So let me click save. And before we go any further, I’ll show you how to show that component in Lightning experience here momentarily.

But let’s look at our duplicate record sets and see if we’ve got any. Now, if we go to all, instead of I thought it would create a duplicate record set. Now, we’ll get back to that here momentarily. But I wanted to show you from here, what you can do is you can edit the page. And then I wanted to show you specifically this component right here, which is potential duplicates. You can actually show this from the detail page so that not only does it appear in the new record entry mode, which I believe that happens by default in salesforce, but you can also add that to the detail page so you can see any potential duplicates if they exist.

So as you’re looking at the details of an account, it shows you any potential duplicates. I just drag that potential duplicates Lightning component, which is a standard component, inside of the Lightning app builder, onto the canvas here, and I’ll click Save for this page. And then I want to activate this and this is an account page. And so now I could make this the default and click Save. And then as well, I could also make this the app default for sales. For example, let me click next. Click Save. Let me click Save here just in case. Click back. And so now, if we go back into that new account that I created, we’ll see the one duplicate. And you see here there’s Double Toast message. I’m not sure why there’s two, but it’s saying that we found one potential duplicate of this account. And you can view duplicates here as well if you don’t get to that Toast message in time.

Now, there’s two records here. The one that’s checked is the one that we’re currently on, and here’s a potential duplicate. Now we can merge these as well. And so that’s what’s useful about this potential duplicates component and why it’s important to add that to the detail page once you’ve implemented duplicate management is that that then allows you to merge records together. So then I click next and I can decide which is the winner between these two. So if the billing address was different, I could decide, okay, I want this to be the winning entry or this to be the winning entry. They’re exactly the same, so it doesn’t really matter.

You can also show all fields to see if there’s any differences between the two and then decide the winner of each for any data that is available. You can’t select the winner if there’s no data in those specific fields. And then click next. And then we confirm that we want to merge these two accounts. So that is merging those two duplicate records by way of the potential duplicates Lightning component. Now let me go back into duplicate record sets and see if we have any. And I may need to troubleshoot why we don’t have any if that’s the case. Let me click all duplicate record sets and we still don’t have any. So let me dive into duplicate record sets in the next lesson.

Leave a Reply

How It Works

Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!