Best Match Account Functionality 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 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.
  1. 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.
  2. The Fullcast Policy Rules Name is automatically picked which is the unique name used by the API and managed packages.
  3. Pick Criteria as Fuzzy Logic and AND or OR Condition fields from the drop-down menu available.
  4. String field needs to be updated only if the Criteria field picked is LITERAL.
  5. Field 1 Object is Lead or Contact which needs to be compared with the Account.
  6. Field 1 is the API field of the Field 1 object which needs to be compared API field of the Account.
  7. Field 2 Object should always be Account which is compared with Field 1 object.
  8. Field 2 is the API field of Field 2 Account which is compared with the API field of the Field 1 object.
  9. 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.
  10. 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.
  11. Module name carries the name of your choice. It is an optional field.
  12. 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.
  1. 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.
  1. In the Matching Rules fields select from the drop-down menu to define how duplicate records are identified.
  2. 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.
  3. Select the Matching rule required for comparison. In this particular example, it is the Standard Account Matching Rule.
  4. Select the fields that need to be mapped. The below example shows the fields that are mapped in the Standard Account Matching Rule.
  1. 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.
  1. Click Save to create the duplicate rule.

  2. 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



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.

Calling BMA from Process Builder

  1. The process builder needs to be created in order to sync the domain and call the BMA.
  2. Once the lead is triggered BMA should be fetched.
  3. BMA will be fetched based on the BMA rules.
  1. We can call both Clean domain and BMA functionality through Process builder. We can execute both the functionalities based on the inputVal1 and inputVal2.
    (i) If inputVal1 is Yes, it will call clean domain functionality.
    (ii) If inputVal1 is No, it will not call clean domain functionality.
    (iii) If inputVal2 is Yes, it will execute BMA functionality.
    (iv) If inputVal2 is No, it will not execute BMA functionality.

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.


Example screenshot for Fuzzy match 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.

10351035 957957 11261126 13651365

Case 2: Using Picklist in Condition


Case 3: Using Number Field


Case 4: Using Date field in Condition

11061106 13451345

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.

13441344 11131113