Skip to content

Duplicate Matching

Mat Ruff edited this page Jul 29, 2019 · 4 revisions

The Interaction process utilizes native Salesforce Data.com Administration Duplicate Management Matching Rules and Duplicate Rules. Review the Customize Duplicate Management Rules and Reports Salesforce Knowledge article for more information about creating duplicate and matching rules in Salesforce.

A Lead Duplicate Rule, Lead Matching Rule, Contact Duplicate Rule and Contact Matching Rule are required for the Interactions process to work, and steps for creating basic versions of these rules are included in the Installation and Configuration Guide. These rules can be altered by a system administrator to meet a university’s business processes, but there are parameters to follow to ensure Interactions work properly.

Leveraging Duplicate Management

The Interaction process finds matching records in Salesforce by relying on system errors generated by Duplicate Rules. These errors include the Salesforce ID of the record found, and the Interaction process uses that ID to merge or update records.

Lead Duplicate Rule

The Lead Duplicate rule is important not only for Lead Only Interactions, but as the first step in a standard Interaction, when a Lead is created so the Lead Conversion process can be leveraged.

Lead Duplicate Rule

The following settings must be included on the Lead Duplicate Rule:

  • Object = Lead
  • Record-Level Security = Bypass sharing rules
  • Action On Create = Block
  • Action On Edit = Block
  • Active = True
  • Matching Rule = Interaction Lead Matching

Setting the Action on Create and Edit to “Block” ensures a match generates an error the Interactions process is able to use to identify the record. Setting the Record-Level Security to “Bypass Sharing Rules” means all records will be included regardless of sharing settings the Salesforce environment may contain.

Lead Matching Rule

The Lead Matching Rule is used by the Lead Duplicate Rule to determine the criteria that represents a record match.

Lead Matching Rule

The Lead Matching Rule used in the documentation contains the criteria:

Lead FirstName is a FUZZY match AND Lead LastName is an EXACT match AND (Lead Email is an EXACT match OR Constituent ID is an EXACT match)

For the Interactions process to receive all the information needed in the error message, the Company field must also be included in the rule by following this format:

(Matching Criteria) AND (Company EXACT OR (Matching Criteria))

Here is how it looks in the Contact Matching Rule used in the documentation:

(Lead FirstName is a FUZZY match AND Lead LastName is an EXACT match AND (Lead Email is an EXACT match OR Constituent ID is an EXACT match)) AND (Company is an EXACT match OR (Lead FirstName is a FUZZY match AND Lead LastName is an EXACT match AND (Lead Email is an EXACT match OR Constituent ID is an EXACT match))

Keep the following in mind when altering this Matching Rule:

  • Follow the formatting described above, including the parentheses
  • Any field included in the matching criteria must be mapped from Interaction to Lead using an Interaction Mapping record

Contact Duplicate Rule

The Contact Duplicate rule is important during the Lead Conversion step in the Interaction process.

Contact Duplicate Rule

The following settings must be included on the Contact Duplicate Rule:

  • Object = Contact
  • Record-Level Security = Bypass sharing rules
  • Action On Create = Block
  • Action On Edit = Block
  • Active = True
  • Matching Rule = Interaction Contact Matching

Setting the Action on Create and Edit to “Block” ensures a match generates an error the Interactions process can use to identify the record. Setting the Record-Level Security to “Bypass Sharing Rules” means all records will be included regardless of sharing settings the Salesforce environment may contain.

Contact Matching Rule

The Contact Matching Rule is used by the Contact Duplicate Rule to determine the criteria that represents a record match.

Contact Matching Rule

The Contact Matching Rule used in the documentation contains the criteria:

Contact FirstName is a FUZZY match AND Contact LastName is an EXACT match AND (Contact Email is an EXACT match OR Constituent ID is an EXACT match)

For the Interactions process to receive all the information needed in the error message, the Account field must also be included in the rule by following this format:

(Matching Criteria) AND (Account EXACT OR (Matching Criteria))

Here is how it looks in the Contact Matching Rule used in the documentation:

(Contact FirstName is a FUZZY match AND Contact LastName is an EXACT match AND (Contact Email is an EXACT match OR Constituent ID is an EXACT match)) AND (Account is an EXACT match OR (Contact FirstName is a FUZZY match AND Contact LastName is an EXACT match AND (Contact Email is an EXACT match OR Constituent ID is an EXACT match))

Keep the following in mind when altering this Matching Rule:

  • Follow the formatting described above, including the parentheses
  • The matching criteria on the Contact Matching Rule must match the matching criteria from the Lead Matching rule as closely as possible
  • Any field included in the matching criteria must be mapped to the Contact in the standard Lead Mappings in setup on the Lead Object
  • Any field included in the matching criteria must be mapped from Interaction to Contact using an Interaction Mapping record

Matching with Opportunity Key

Duplicate Management does not support Opportunities, so the Interactions process uses the Opportunity Key field on Interactions and Opportunities to match records. The Opportunity represents the prospect or applicant’s interest in enrolling in a plan and term. Some information received should update the Opportunity, while other information may signify a new recruitment interest and require a new Opportunity to be created. This key can be customized to meet your university’s recruitment process. See the Installation and Configuration Guide for more information. Read on for an explanation of the key provided in the package.

The Opportunity key is made up of five main parts:

Contact ID The 18-digit Salesforce ID for the Contact matched or created from theInteraction It is not in the Opportunity Key formula field on Interactions, becauseit is added by the Interactions code after the Contact is updated or created,but before the Opportunity is updated or created.
Career A text value from a picklist set on Plan records. Possible values are Graduate and Undergraduate. The Career from the Recruitment Interest associated to the Academic Interest will be used, unless Academic Interest is blank, then the Career from Recruitment Interest will be used.
Term ID The 18-digit Salesforce ID for the Term listed on the Interaction
Academic Interest The official degree an applicant applies to and is enrolled in It is only used in the key for a decentralized recruitment model where a plan change represents a new Opportunity. By default, when the Career = Graduate.
Recruitment Interest The marketable degree a prospect first shows interest in, which may be a combination of Academic Interests or a plan that is not yet offered It is only used in the key when Academic Interest is blank for a decentralized recruitment model, where a plan change represents a new Opportunity. By default, when the Career = Graduate.

These pieces of data are used in the Opportunity Key formula field on Interactions, the Apex code in the Interactions process, and the Opportunity workflow rules.

Interaction Opportunity Key Formula

Here is what the Opportunity Key formula field looks like on Interaction, including comments. Keep in mind the Interaction code uses the 18-digit Salesforce ID of the Contact matched or created and adds the value returned to the beginning of the below formula to create the full Opportunity Key:

/*The below formula allows for a centralized and decentralized recruitment model. If there is no Plan, this formula is blank and no Opportunity will be created or updated.*/ 
 IF(Academic_Interest__c + Recruitment_Interest__c = "","", 
/*If the Academic Interest Career = Undergraduate, or Academic Interest is blank and the Recruitment Interest Career = Undergraduate, this formula uses the centralized model (one Opportunity per Term)*/ 

 IF(OR(ISPICKVAL(Academic_Interest__r.Career__c, "Undergraduate"), AND(ISBLANK(Academic_Interest__c), ISPICKVAL(Recruitment_Interest__r.Career__c, "Undergraduate"))), ".Undergraduate."+Term__r.Id,

/*Otherwise, this formula uses the decentralized model (one Opportunity per Academic Interest or Recruitment Interest and Term)*/ 

 ".Graduate." + 

/*If there is no Academic Interest, the decentralized model adds the Recruitment Interest Id. Otherwise, the model uses the Recruitment Interest ID from the Academic Interest, or if there is none, the Academic Interest ID is used as a last resort. Most Academic Interests should have a Recruitment Interest ID to ensure a smooth process from inquiry to application.*/ 
IF(ISBLANK(Academic_Interest__r.Id), Recruitment_Interest__r.Id, IF(ISBLANK(Academic_Interest__r.Recruitment_Interest__c), Academic_Interest__r.Id, Academic_Interest__r.Recruitment_Interest__r.Id))+"."+Term__r.Id))
 

The formula on the previous page returns one of the following options:

  • .Undergraduate.{Interaction.Term__c}
  • .Graduate.{Interaction.Academic_Interest__r.Recruitment_Interest__c}.
  • {Interaction.Term__c}
  • .Graduate.{Interaction.Academic_Interest__r. Interaction.Term__c}
  • .Graduate.{Interaction.Recruitment_Interest__r. Interaction.Term__c}
  • [NULL]

Please note the following:

  • If both Academic Interest and Recruitment Interest are blank or have no Career listed, the formula will return NULL, and will skip the Opportunity steps in the process.
  • If the Term is blank, the Opportunity Key will not contain all the necessary information, and this could cause duplicate issues.
  • Because inquiries normally provide only a Recruitment Interest and applications an Academic Interest, the Recruitment Interest associated to the Academic Interest is used in the decentralized model when possible so applications received can be easily matched to previous inquiries. Associate Academic Interests to Recruitment Interests where possible to take advantage of this design and prevent duplicate Opportunities from being created.

Apex Code Opportunity Key Creation

The Interactions process attempts to create an Opportunity with a CloseDate of Today, a StageName matching the Opportunity_Stage__c field on Interaction, the AccountId of the Administrative Account found or created in an earlier step in the process, and the Opportunity_Key__c equaling the Contact ID of the Contact found or created in an earlier step plus the Opportunity_Key__c field on Interaction, shown below.

Apex Code Opportunity Key Creation Example

Because the Opportunity Key field on Opportunity is a unique text field, Salesforce will send back an error if the key matches an existing Opportunity. This error will include the ID of the existing Opportunity, which the code will use to update the record instead of creating a new one.

Opportunity Key Workflow

Opportunities can be created or updated outside of Interactions, so it is necessary to ensure the Opportunity Key is set and correct for all Opportunity records. This is done through a workflow rule and field update.

Opportunity: Update Opportunity Key Workflow

The workflow rule evaluates to true when an Opportunity is created or edited and the Opportunity_Key__c does not match the expected value based on the Contact ID followed by the Opportunity Key formula. When the workflow rule evaluates to true, the field update runs, which sets the Opportunity_Key__c field to the Contact ID + the Opportunity Key formula.

Opportunity Key Field Update

Centralized Opportunity Key Example

Centralized Opportunity Key Example

The Opportunity Key is Contact ID.Undergraduate.Term ID

Decentralized Opportunity Key Example

Decentralized Opportunity Key Example

There is no Academic Interest on this record, so the Opportunity Key is Contact ID.Graduate.Recruitment Interest ID.Term ID

Clone this wiki locally