[SalesForce] Are Duplicate Rules Supported by Metadata

I've found how to reference Matching Rules by name in Metadata, but that's only the logic to identify a duplicate. I'm looking for how to reference Duplicate Rules by name in Metadata, which will dictate what to do when a duplicate is found.

Does anyone know if it's supported in Metadata yet, and if so what's the name to reference it?

XML from retrieving

<types>
    <members>*</members>
    <name>MatchingRule</name>
</types>

<MatchingRules xmlns="http://soap.sforce.com/2006/04/metadata">
<matchingRules>
    <fullName>Custom_Contact_Rule1</fullName>
    <booleanFilter>((1 AND 2) OR 3 OR 4) AND 5</booleanFilter>
    <label>Custom Contact Rule1</label>
    <matchingRuleItems>
        <blankValueBehavior>NullNotAllowed</blankValueBehavior>
        <fieldName>FirstName</fieldName>
        <matchingMethod>FirstName</matchingMethod>
    </matchingRuleItems>
    <matchingRuleItems>
        <blankValueBehavior>NullNotAllowed</blankValueBehavior>
        <fieldName>LastName</fieldName>
        <matchingMethod>LastName</matchingMethod>
    </matchingRuleItems>
    <matchingRuleItems>
        <blankValueBehavior>NullNotAllowed</blankValueBehavior>
        <fieldName>Email</fieldName>
        <matchingMethod>Exact</matchingMethod>
    </matchingRuleItems>
    <matchingRuleItems>
        <blankValueBehavior>NullNotAllowed</blankValueBehavior>
        <fieldName>Phone</fieldName>
        <matchingMethod>Phone</matchingMethod>
    </matchingRuleItems>
    <matchingRuleItems>
        <blankValueBehavior>NullNotAllowed</blankValueBehavior>
        <fieldName>AccountId</fieldName>
        <matchingMethod>CompanyName</matchingMethod>
    </matchingRuleItems>
    <ruleStatus>Active</ruleStatus>
</matchingRules>


I would expect to be able to retrieve Duplicate Rule data as well, which specifies the following pieces of data

  • If sharing rules are enforced
  • If users can bypass the creation on create or edit
  • How the fields are mapped

Best Answer

Migrating Duplicate Rules via Metadata API is officially supported starting with API version 42.0 (Spring '18). See the official documentation on how to use: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_duplicaterule.htm

Related Topic