4

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
  • Isn't matching rule is what used to identify the duplicates in an object? Or, are you looking for how to invoke one of these defined matching rules and get the duplicates? – singularity Feb 24 '15 at 17:15
  • You are correct - a MatchingRule defines logic to identify the duplicate in an object. I'm looking for DuplicateRule, which defines the logic to handle the duplicate once found. Very similar to WorkflowRule and an action on the WorkflowRule - like FieldUpdate. I will update my question to show the xml pulled from MatchingRules as well as what data I'm looking to pull as well. – zainogj Feb 24 '15 at 17:22
  • As of today, it seems to be unsupported. There is an idea for it on the IdeaExchange. – zainogj Feb 24 '15 at 19:07
  • Thanks. But be aware that changesets are different features than metadata api, even though both are for deployment. There are many components which are supported in Metadata api but not in changeset – singularity Feb 24 '15 at 19:14
0

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

2

As mentioned on this idea, this is not included in the metadata and Salesforce is currently planning to add it to the roadmap. I'll update this answer once I hear that it's been released.

  • absence of this feature doesn't pass the straight-face test :-( – cropredy Jun 8 '16 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.