How to Bypass Duplicate Rules in Flow in Salesforce

How to Bypass Duplicate Rules in Flow in Salesforce

In Salesforce, bypassing duplicate rules temporarily is important to make other automation run smoothly without causing errors. Duplicate rules are an essential automation that prevents duplicate records from being created within Salesforce. But there are some requirements where we need to bypass these duplicate rules, such that the automation, like Salesforce flows, runs smoothly without hitting errors.

In this blog, we will learn how to bypass duplicate rules in flow in Salesforce.

Step-by-Step Implementation: Bypass Duplicate Rules in Salesforce Flows

Step 1: Create Required Fields

Add these fields to your object, where you want to bypass duplicate rules

  • Duplicate Rules Bypass Start Time (DateTime)
  • Duplicate Rules Bypass Active (Formula Checkbox)

salesforce field - Duplicate Rules Bypass Start Time

salesforce Duplicate Rules Bypass Active

Configure the Formula Field Logic: NOW() – Duplicate_Rules_Bypass_Start_Time__c <= (5/ 86400)

This formula creates a temporary 5-second time frame where it marks the field Duplicate Rules Bypass Active as true. This formula checkbox field value is then referenced in duplicate rules, and the duplicate rules are bypassed automatically.

Formula Explanation:

  • NOW()
    • Represents the current date and time when Salesforce evaluates the formula.
  • Duplicate_Rules_Bypass_Start_Time__c
    • A custom datetime field set by your flow when it begins execution.
    • Stores the exact moment the bypass period should start.
  • 5 / 86400
    • 5 = Number of seconds the bypass should remain active (you can set your preferred duration in seconds based on the flow’s complexity).
    • 86400 = Converts seconds to days.
    • This ensures the comparison works correctly in Salesforce’s date/time system.

The formula is TRUE within 5 seconds of Duplicate_Rules_Bypass_Start_Time__c. In this time frame, duplicate rules are bypassed. After 5 seconds, the formula automatically switches to FALSE, re-enabling duplicate rule checks.

Step 2: Modify the Duplicate Rule

To open duplicate rules, go to Setup by clicking the gear icon, search for Duplicate Rules in the Quick Find box, click Duplicate Rules and select the rule you want to add the bypass logic.

Edit the duplicate rule and add a condition, Duplicate Rule Bypass Active is equal to FALSE. This way, the duplicate rule will only trigger for the records where the Duplicate Rule Bypass Active field is FALSE.

salesforce lead object duplicate rule condition

lead duplicate rule

Step 3: Build the Flow

In your Salesforce flow

  1. Set Bypass Time: Set the value of the field Duplicate Rules Bypass Start Time to {!$Flow.CurrentDateTime}
  2. Perform DML Operations: Run your create/update records logic.

Example:

Let’s create a before trigger flow for the Lead object based on this use case: Whenever a Lead with the Lead Source set to “Partner Referral” is created or updated, we want to bypass the duplicate rule.

Now, letโ€™s discuss how this Flow will work.

lead bypass flow update

When a Partner Referral lead is created or updated, we want to update its Rating to “Hot”, even if a duplicate already exists in the system.

To make sure the duplicate rule does not block this update, we will set the bypass start time to the Flowโ€™s Current DateTime. This helps temporarily skip the duplicate check during the Flow execution by making the formula checkbox true.

Duplicate Error Before Bypass:

lead duplicate error

Duplicate Error Bypassed:

lead duplicate bypassed

duplicate successful creation

bypass checkbox set to false

Using the bypass start time and the bypass active checkbox, we are bypassing the duplicate rule smoothly without getting a flow automation error. The checkbox is set to false automatically without any manual intervention, making the process easy.

Also Read – Top Flow Features in Summer ’25 Release

FAQs

1. How do I deactivate duplicate rules in Salesforce?

Log in to your Salesforce account, go to Setup by clicking the gear icon, search for Duplicate Rules in the Quick Find box, click Duplicate Rules, then click Deactivate next to the rule you want to disable.

2. What is the difference between duplicate rules and matching rules?

Matching Rules define how we can identify potential duplicates based on record field values in Salesforce.
Duplicate Rules tell us what action to take when a match is found, like blocking the record or showing a warning.

Conclusion

By following the method shared above, you can temporarily bypass duplicate rules during automated processes like Salesforce flows, ensuring the bypass remains controlled and limited to only where necessary.

Get a complete Roadmap To Learn Salesforce Admin and Development

Share Now

Surya is a passionate Salesforce Developer specialising in Salesforce development and administration.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *