Matching and Duplication
  • 07 Jul 2023
  • 3 Minutes to read
  • Dark
    Light

Matching and Duplication

  • Dark
    Light

Article summary

Relationship Settings give you better control over Lead, Contact, and Account matching and creation. With this feature, you can define which records should be matched and created when a Payment Gateway Customer is created.

Before You Start

The following notes are important to review before you start.

  • Matching criteria are based on Matching and Duplication rules specified in Setup. The Account, Contact, and Lead objects are compared to either find a match or create a new record.
  • Matching and Duplication rules are required for the Relationship Settings "Create New Record If No Match" and "Only Relate a Matched Record" options.
  • We recommend using the Standard Salesforce Matching and Duplication rules for Account, Contact, and Lead. If you do not enable the Standard Salesforce Matching and Duplication rules, the Relationship Settings will not know which items to match when creating a new record.

How Does It Work?

The Relationship Settings field is located on the Payment Gateway object. This field controls how Payment Gateway Customers, Contacts, Accounts, and Leads are created on a payment gateway. To allow for a variety of scenarios, the Relationship Settings field can be defined differently for each payment gateway your organization uses.

Relationship Settings define the matching and/or creation preferences for your org.

The logic starts with the Payment Gateway Customer and rolls down to the customer’s Payment Method. The following steps show the order of execution.

  1. The new Payment Gateway Customer (PGC) record is added to Salesforce via API and webhooks.
  2. The PGC record is compared to your active duplicate rules in conjunction with your Relationship Settings. (Duplicate rules determine what is or isn’t a match.)
  3. The Relationship Settings determine how to match existing Contacts, Leads, or Accounts to the PGC record.
  4. If your settings are configured to do so, a new Contact, Lead, or Account record will be created.

Did you upgrade Payments?

Users upgrading Payments will need to manually deactivate the current “Payment Gateway Customer Dup Rule” matching rule and activate the new Payment_Gateway_Customer_Matching_Rule2 matching rule. The new matching rule will be installed automatically for new installations.

Configure Your Relationship Settings

  1. Click the App Launcher.
  2. Type and click “Relationship Settings”.
  3. Click New in the top-right-hand corner of the page.Create Relationship Settings_1
  4. Enter a Name. (required)
  5. Select a Relationship Rule.
    • “Only Relate A Matched Record”: This setting updates existing records. It doesn’t create new records.
    • “Create New Record If No Match”: This setting creates a record if a match isn’t detected.
    • “Always Create A New Record”: This setting ignores duplication rules and creates a new record even if an existing record already exists.
    • “No Matching Or Record Creation”: This setting prevents matching and the creation of new records.
  6. Define a Create Rule. This field selects the type of related record to be created.
  7. Select an Account, Contact, or Lead record type, if using. 
  8. Click Save.

Create Relationship Settings_2

Default Relationship Settings
You can only mark one Relationship Setting record as the default setting for your org. A validation rule exists to prevent multiple records from being set to default.

Example

  1. Set Relationship Rule = "Create a record if no match".H_02_09_configuration 3
  2. Set Create Rule = "Lead".  
  3. Create a customer in Stripe.
  4. Wait for webhooks to process. Or manually process webhooks by navigating to your Payment Gateway, clicking Sync with Stripe, and clicking Sync Customers.

Once the sync is finished, your new Lead record and Payment Gateway Customer will be generated in Salesforce.

H_02_09_configuration 4

Additional Fields for Matching Logic Variations

Match Records

Some scenarios do not require matching on all three objects: Accounts, Contacts, and Leads. The Match Records field is a multi-select picklist that allows users to select which object they want to use for matching.

Important

If you leave the Match Records field blank and don't have active duplicate rules for Lead, Contact, and Account, you will receive an error in the Blackthorn Logs. Additionally, if this field is blank your current matching logic will not continue to find matches.

Match All Email Fields

If the Match All Email Fields field is checked, the duplication logic will look for all email fields from the object selected in the Match Records field and execute matching criteria based on the matching rules in Settings.

H_02_09_matching logic variations

Requirement
You must create matching and duplication rules for each email address field if you use the Match All Email Fields field.

Use Case

Let's say you want to match the Email field on a new Payment Gateway Customer to a custom field named Work_Email__c on the Contact object.

  1. Create a matching and duplication rule from Setup for the Work_Email__c field on the Contact object.
  2. Add your Relationship Setting to your Payment Gateway record.
  3. Set Match Records so “Contact” is one of the values selected.
  4. Check the Match All Email Fields checkbox.
  5. Create a Contact record with Work_Email__c populated.
  6. Create a Payment Gateway Customer with the same value that was used for the Contact Work_Email__c field.
  7. After clicking Save, notice the existing Contact record is populated in the Contact lookup on Payment Gateway Customer.


What's Next