Stage: We have a legacy codebase from another outsourcer. We're adopting it for SFDX now.

Several tests are now failing because they generate duplicate Contacts. We'd like to avoid rewriting those tests because we plan to get rid of them completely later in the project.

As a quick fix, we want to deactivate duplication rules on scratch orgs we use for CI test run.

I couldn't find any info on how to this through SFDX during or after scratch org provisioning. Maybe someone faced the same issue before or just knows somehow how to achieve this with SFDX CLI?

  • You could use puppeteer to enable or disable settings, we have been using this for a while, works quite nicely!
    – Raul
    Apr 23, 2019 at 14:03

1 Answer 1


You can include the duplicateRules in your sfdx project tree in a disabled state and when you push them to your new scratch org, they will disable them in your scratch org



The contents of that file:

<?xml version="1.0" encoding="UTF-8"?>
<DuplicateRule xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <alertText>Duplicate Alert</alertText>
    <description>Duplicate rule for contact records.</description>
    <duplicateRuleFilter xsi:nil="true"/>
        <objectMapping xsi:nil="true"/>
    <masterLabel>Standard Contact Duplicate Rule</masterLabel>

Note the isActive element

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .