Best Match Account Functionality with Fuzzy Logic

IN THIS ARTICLE
  1. Introduction to fuzzy logic                   
  2. Salesforce matching methods                  
  3. Matching rules and Duplicate rules
  4. How to find Best Match Account with fuzzy logic?
  5. BMA with fuzzy logic cases which involve different criteria and conditions

Introduction to Fuzzy logic

Fuzzy logic is a way to model logical reasoning where the truth of a statement is not a binary true or false, but rather it is with the degree of truth that ranges from 0 (false) to 1 (true). 

When there is uncertainty in data and the search criteria, the Fuzzy logic option helps to filter the available best match account, as it can incorporate all intermediate values between True and False. (Fuzzy Matching- Approximate String Matching)

Salesforce Matching methods 

Source Courtesy: https://www.salesforceben.com/what-are-fuzzy-matches-in-salesforce-deduplication/

Exact Match

For this match, as the name suggests, the fields in the two records should be the exact same. The match is either True or False

Record A Record B Method Evaluation
John Doe John Doe Exact True
Jon Doe Jon Doe Exact False

In the solutions, which have exact match with random order, the words match exactly but not in the same order.

Record A Record B Method Evaluation
John Doe Doe John Exact (random Order) True

Fuzzy Match

Fuzzy match will return a match where the fields are more or less similar, and the most used algorithm to find this is Edit Distance. This algorithm holds good and better for longer strings rather than shorter ones. 
Edit distance is the number of single character edits (insert, delete or change) needed to change one string into another.
Jon Doe <> John Doe has an edit distance of 1. In this case only the insertion of the letter ‘h’ in John will make the two strings equal.
The goal of matching is to return similar results (with the same meaning). So that suggests that only using edit distance for this goal is not ideal, especially for shorter strings (names, words). Consider the following:
Record A Record B Method Edit Distance Intended meaning
Cat Hat Fuzzy 1 Very Different
Elephant Elephont Fuzzy 1 Same

Shorter strings often have entirely different meanings with one or two edits. The longer the string, the less the impact of an edit on the meaning. To combat this problem, most deduplication solutions use a matching score based on multiple fields and a threshold to determine duplicate records.

Record A Record B Method Edit Distance Max Edit Distance Score
Cat Hat Fuzzy 1 3 66.6%
Elephant Elephont Fuzzy 1 8 87.5%

So longer the string, higher the matching score. This is the basic fuzzy logic used by Salesforce to compare two records. To know more in detail about Salesforce Fuzzy logic click here

Matching Rules and Duplicate rules

Matching Rules
A matching rule applies criteria to determine how closely a field on a new or edited record matches the same field on an existing record. Standard matching rules include predefined criteria. When you create a custom matching rule, you define the criteria.
Duplicate Rules
A duplicate rule defines what happens when a user views a record with duplicates or starts creating a duplicate record. Salesforce provides standard duplicate rules for business and person accounts, contacts, and leads. Customized duplicate rules can also be created. 
Difference between Matching Rules and Duplicate Rules
Matching Rules will identify what field and how to match. For example, Email Field, Exact Match or Account Name, Fuzzy Match. They don’t do anything on their own.
Duplicate Rules will use those Matching Rules to control when and where to find duplicates. For example, “Use Account Name, Fuzzy Match to find duplicates on the Account object upon creation” or “Use Email, Exact Match, to find duplicates on Leads and Contacts, upon create and edit.”
An overview of these logic and rules will help in understanding how to formulate better rules to find the best match account with fuzzy logic. Below screenshot of different case studies of BMA with the fuzzy logic results for the Account name Athena Health Limited gives an insight about how BMA results are fetched. 


How to find Best Match Account with fuzzy logic?

BMA fuzzy logic Pre-requisites

  1. Create Fullcast Policy rule in Custom metadata type. 
  2. Enable Standard Account Duplicate rule in Salesforce. 
  3. Enable triggers in Fullcast Setting   OR
  4. Call BMA using Process builder to fetch clean domain functionality or BMA.

If the rules don't create a single best match account, the BMA logic will select the oldest created account.

Creating Fullcast Policy Rules for Best Match Account

Fullcast policy rules are configured in the Salesforce instance. 

  1. Log in to the Salesforce account. 
  2. Click on the Setup and search for Custom Metadata types 
  3. Click on Manage Records against Fullcast Policy Rules. 
  4. Click New and start creating the rules.

  5. Enter label name which must begin with a letter and use only alphanumeric characters and underscores. The name cannot end with an underscore or have two consecutive underscores.
  6. The Fullcast Policy Rules Name is automatically picked which is the unique name used by the API and managed packages. 
  7. Pick Criteria  as Fuzzy Logic and  AND or OR Condition fields from the drop-down menu available. 
  8. String field needs to be updated only if the Criteria field picked is LITERAL.
  9. Field 1 Object is Lead or Contact which needs to be compared with the Account.
  10.  Field 1 is the API field of the Field 1 object which needs to be compared API field of the Account.
  11.  Field 2 Object should always be Account which is compared with Field 1 object.
  12. Field 2 is the API field of Field 2 Account which is compared with the API field of the Field 1 object. 
  13.  Choose which operation to be performed from the drop-down menu for the field Operator. Use the table to pick the correct operator based on the Field type being used in Field 1 and Field 2 in the rules.
  14.  Enter the number according to which the rule has to be executed. For example, if it has to be executed first then the order number is 1. If it has to be executed third, then the order number is 3, and likewise. 
  15. Module name carries the name of your choice. It is an optional field.
  16. Click Save to trigger and call the policy rule whenever necessary.  

Configuring Salesforce Duplicate rules and Matching rules

The duplicate rule needs to be configured in the Salesforce environment, to make the Fullcast Fuzzy Logic operator work and find the Best Match Account. 
  1. Search for Duplicate Rule in the Quick find tab in the Salesforce environment.
  2. Select Account from the dropdown menu for which the rule has to be created. Create New Duplicate Rule by clicking the New rule tab. 

Creating a New rule

  1. Enter the Rule Name. Description field which describes the rule is an optional field.
  2. Object for which the rule is created is displayed in the object field. 
  3. For Record-level security choose whether to enforce or bypass sharing rules according to the organization's policy. By enforcing sharing rules, the matching rule compares only those records to which the user has access to, whereas bypassing sharing rules compares all the records. 
  4.  Set the actions which need to be performed when the user creates or edits a duplicate record. When you choose alert, provide an appropriate alert message as to why the user is not able to save the record and what's the next step.  

  5. In the Matching Rules fields select from the drop-down menu to define how duplicate records are identified. 
  6. Select the field with which the Accounts need to be compared with from the drop-down menu. In the below example it is compared with accounts. The Account can be compared with Lead, but the lead detail fields are mapped to the particular account detail fields in the backend and finally those mapped fields are compared. So even when you want to compare accounts to lead, it is mandatory to select Accounts as it is already mapped. 
  7. Select the Matching rule required for comparison. In this particular example, it is the Standard Account Matching Rule. 
  8. Select the fields that need to be mapped. The below example shows the fields that are mapped in the Standard Account Matching Rule. 

  9.  If there are any conditions to be met for the rule to run, those conditions need to be set in the Conditions fields which are optional. 

  10. Click Save to create the duplicate rule. The standard account duplicate rule created screen will look like the following: 

  11. The fuzzy logic rule will fetch records that are the best match for the account. This can be further filtered using the Tie-Breaker or Field- Compare

BMA version 2.166

New BMA fuzzy logic feature has been added in the package version 2.166. Currently we are considering all the duplicate accounts coming from all the active duplicate rule. This package feature enables the user to pass only particular duplicate rules name to filter the duplicate records for BMA. 

  • If string value is NULL - then it will pick the matched account from all the duplicate rules.
  • If string value is comma separated values of Duplicate Rule API name, then only matched account from those Duplicate Rules are picked.

Note

If there are any Custom Duplicate Rules Enabled and if the above mapping rules to Lead and Account gives a set of Accounts. Those Accounts are also considered for calculation of Best Match Account.

Standard Account Matching Rule

The standard account matching rule identifies duplicate accounts using match keys, a matching equation, and matching criteria. It’s activated by default. More than one rule can be added if needed. It can be removed as well if not necessary.

For accurate matches, the new or edited record must include a value in the Account Name field and either the City or the ZIP Code field.

(Account Name AND Billing Street) OR (Account Name AND City AND State) OR (Account Name AND ZIP) OR (Account Name AND Phone) OR (Website AND Phone) OR (Website AND Billing Street)

Triggering the BMA function

After setting up the rules, it is essential to trigger the process either by enabling the flags in Fullcast setting or by calling BMA in Process builder.

Enabling triggers in Fullcast Setting

  1. Click on the Setup and search for Custom Metadata types
  2. Click on Manage Records against Fullcast Setting. 
  3. Click New and start creating the Fullcast Setting.
  4. Select a Label for the setting.
  5. Check the Account, Contact and Lead trigger flags.
  6. Set a number for the Error log that needs to be displayed. 
  7. Click save. When these flags are checked, the clean domain functionality will be triggered when there is a website address in the Website field. Whenever a new data is added or edited in the website field the clean domain functionality is triggered. 

Configuration of Process Builder for BMA with Fuzzy logic

Setting up a process builder in Salesforce environment for each policy to trigger it when needed is necessary. Follow the below screenshot for process builder setup. 
You can also refer to Configuration of Process builder in Motion policies document for detailed step-by step process.

  1. The Best Matched Account for the Lead Account is displayed in the BMA field if there is any record found. Below is an example of Lead detail with a best matched account.


BMA with fuzzy logic cases which involve different criteria and conditions

The below screenshots give an understanding of the different BMA with fuzzy logic cases which involve different criteria and conditions.
Case 1: Country Field matching

Field setup needs to be created in Fullcast Policy setting by using the field value directly or Lead field value can be used as shown below. 

Case 2: Using Picklist in Condition

Case 3: Using Number Field

Case 4: Using Date field in Condition

Condition 1: When the proper Lead value is given according to the condition then it will fetch the correct BMA. 
Condition 2: For the same case if the Lead date value given is wrong then it should not fetch the correct BMA.

Condition 3: When the date value equals null, it should fetch the data correctly. 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us