How does Best Match Account work?

The best match account process is a filtering mechanism based on the rules configured in a specific order to get a record (lead/opportunity/cases/contact) to match one account.

Fullcast policy rules are configured in the Salesforce instance. to create policy rules for BMA:

  1. In Salesforce, navigate to Setup > Custom Metadata > Manage Records > Fullcast Policy Rules.

  2. Click New and start creating the rules.

    Figure 1. Managed Records Callout

    Figure 2. New Button Callout

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

  4. The Fullcast Policy Rules Name is automatically picked which is the unique name used by the API and managed packages.

  5. Pick Criteria and Condition fields from the drop-down menu available.

  6. String field needs to be updated only if the Criteria field picked is LITERAL.

  7. Field 1 Object is Lead or Contact which needs to be compared with the Account.

  8. Field 1 is the API field of the Field 1 object which needs to be compared API field of the Account.

  9. Field 2 Object should always be Account which is compared with Field 1 object.

  10. Field 2 is the API field of Field 2 Account which is compared with the API field of the Field 1 object.

Criteria and Condition Setting

Criteria

Fields Compared

Conditions Supported

Field Compare

Field 1 on the Field 1 Object (Eg. Lead/Contact) to Field 2
on the Field 2 Object (which should always be an account)

AND, OR

Literal

Field 2 on the Field 2 object(Account) to String value provided
on the Custom Metadata.

AND, OR

Tie Breaker

2 best match accounts

MAX, MIN, EXIT

Fuzzy Logic

Unsure data fields

AND, OR

Field Compare Example

Figure 3. Field Compare

Literal example

Figure 4. Literal Example

Tie-Breaker Criteria

‘TIE BREAKER’ - Using the Field compare or Literal criteria if we get more than 1 Account, the TIE between the records has to be broken to find a single record.  

  • More than one tie-breaker criteria could be used.  

  • MIN is used to order the records in ascending order.

  • MAX is used to order the records in descending order.

  • EXIT is used if the user does not want to choose any from the tied (similar) records, instead prefers a null value for the BMA.

Tie-breaker Example

Figure 5. Example Tie Breaker

Figure 6. Example Condition for Tie Breaker

The final account could be decided by the rules configured as shown.

Figure 7. BMA Logic

Single Rule (One order only)

  • In the below setup we have 3 rules resulting in always one account as the output which is ensured by the Max condition.  

  • Since it's based on a single rule we have order for all of them as 1  

Figure 8. Single Rule Example

Multiple Rule (Multiple order)

  • In the below setup we have 2 rules resulting in always one account as the output which is ensured by the Max condition.        

  • Since it's based on two rules we have an order for that as 2    

Figure 9. Multiple Rule Example

BMA Logic

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

  1. Choose which operation to be performed from the drop-down menu for the field   Operator. Use the below table to pick the correct operator based on the Field type being used in Field 1 and Field 2 in the rules.  

Data Types

Operators Supported

PICKLIST

Not Equal To

MULTIPICKLIST

Equals To, Contains All, Contains Any,
Does not contain

URL

Not Equal To

STRING

Equals To

EMAIL

Contains All, Contains Any, Does not contain

BOOLEAN

Not Equals To, Equals to

CURRENCY

Not Equal To

PERCENT

Equals To

DOUBLE

Greater than, Greater than or equals to,
Less than, Less than or equal to

DATE

Not Equals to

DATETIME

Greater than, Greater than or equals to,
Less than, Less than or equal to, Equals to

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

  2. Module name carries the name of your choice. It is an optional field.      

  3. Click Save to trigger and call the policy rule whenever necessary.

Figure 10. Fullcast Policy Rules Edit

The below table gives an idea about the supported basic logical expressions and setup

Figure 11. Supported Basic Logical Expressions and Setup Table

Calling BMA from Flow Builder

Warning:

The flow builder must be created to sync the domain and call the BMA. To configure the flow builder, refer to the Configuring Flows for Motion Policies article.

The apex variables for BMA is as follows:

  1. RecordID : Use field reference in the type to select AccountID

  2. PolicyType: Set the Type to string with value "CleanDomain" (case sensitive)

  3. If inputVal1 is Yes, it will call clean domain functionality.

  4. If inputVal1 is No, it will not call clean domain functionality.

  5. If inputVal2 is Yes, it will execute BMA functionality.

  6. If inputVal2 is No, it will not execute BMA functionality.

    Figure 12. Example Flow Builder Configuration