Skip to main content

Flow Strategy

Flow Strategy allows you to use custom Salesforce Flows to determine master records and field values during auto-merge operations. This provides maximum flexibility for complex merge logic that cannot be achieved with standard strategies.

When to Use Flow Strategy

Use Flow Strategy when:

  • Standard strategies don't meet your needs – You need custom business logic that isn't available in the standard master record or field value strategies
  • Complex decision-making required – Your merge logic involves multiple conditions, calculations, or external data lookups
  • Integration with other systems – You need to check external systems or callouts during the merge process
  • Dynamic field value selection – Field values need to be calculated or derived from multiple sources
tip

Before creating a Flow: Review the standard Auto Merge strategies first. They cover most common use cases and are easier to configure and maintain. Only use Flow Strategy when standard strategies are insufficient.

Flow Strategy Types

There are two types of Flow strategies:

  1. Master Record Strategy: Flow – Determines which record becomes the master record
  2. Field Value Strategy: Flow – Determines the value for a specific field in the master record

Master Record Strategy: Flow

To define a custom Flow-based strategy for selecting the master record during auto-merge, follow these steps:

Step 1: Create an Autolaunched Flow

  1. Go to Setup in Salesforce
  2. In the Quick Find box, type Flows and select Flows
  3. Click New Flow
  4. Choose Autolaunched Flow (No Trigger) and click Create
  5. This flow will receive duplicate records and return the ID of the master record

Step 2: Create Flow Variables

Input Variable

Create a new variable resource with the following exact settings:

  • API Name: InputRecords (must match exactly)
  • Data Type: Record
  • Allow multiple values (Collection): Enabled (checkbox checked)
  • Available for input: Checked (checkbox checked)
  • Object: Select the object relevant to your use case (e.g., Account, Contact, Lead, etc.)
  • Description: Stores a collection of records that belong to the duplicate group, excluding the master record

Create InputRecords Variable

important

Critical: The API Name InputRecords must match exactly. The app uses this name to pass duplicate records to your flow.

Output Variable

Create another variable with the following exact settings:

  • API Name: MasterRecordId (must match exactly)
  • Data Type: Text
  • Available for output: Checked (checkbox checked)
  • Description: Stores the ID of the master record

Create MasterRecordId Variable

important

Critical: The API Name MasterRecordId must match exactly. The app expects this variable to contain the ID of the selected master record.

Step 3: Implement Logic

Design the flow logic to determine which record from InputRecords should be the master. Set the MasterRecordId variable with the chosen record's ID.

Here is a demo video showcasing the custom flow implementation for the Master Record Strategy.

Step 4: Save and Use in Auto-Merge

  1. Save and activate your flow
  2. In the Auto-Merge Setup, set:
    • Master Record Strategy: Flow
    • Flow: Select the custom flow you just created
  3. Click Save

Select Flow As Master Record Strategy


Master Field Strategy: Flow

To define a Flow-based strategy for choosing field values when merging records:

Step 1: Create an Autolaunched Flow

  1. Go to Setup in Salesforce
  2. In the Quick Find box, type Flows and select Flows
  3. Click New Flow
  4. Choose Autolaunched Flow (No Trigger) and click Create
  5. This flow will receive duplicate records and return a field value

Step 2: Create Flow Variables

Input Variable (Required)

Create a new variable resource with the following exact settings:

  • API Name: InputRecords (must match exactly)
  • Data Type: Record
  • Allow multiple values (Collection): Enabled (checkbox checked)
  • Available for input: Checked (checkbox checked)
  • Object: Select the object you're merging (e.g., Account, Contact, etc.)
  • Description: Stores a collection of records that belong to the duplicate group, excluding the master record
important

Critical: The API Name InputRecords must match exactly.

Input Variable (Optional)

Create a new variable resource with the following settings:

  • API Name: MasterRecord (must match exactly if used)
  • Data Type: Record
  • Available for input: Checked (checkbox checked)
  • Object: Same as InputRecords object
  • Description: Stores the master record (optional - use if your logic needs to reference the master record)
note

Optional Variable: The MasterRecord variable is optional. Only create it if your flow logic needs to reference the master record when determining the field value.

Output Variable

Add another variable with the following exact settings:

  • API Name: FieldValue (must match exactly)
  • Data Type: Text (or match your field's data type - Number, Date, Boolean, etc.)
  • Available for output: Checked (checkbox checked)
  • Description: Stores the value to be set in the field
important

Critical:

  • The API Name FieldValue must match exactly
  • The Data Type should match the field you're setting (Text for text fields, Number for number fields, Date for date fields, etc.)

Step 3: Implement Logic

In your flow, add logic to determine which field value should be used. Set the FieldValue variable accordingly.

Here is a demo video showcasing the custom flow implementation for the Field Value Strategy.

(video)

Step 4: Configure in Auto-Merge Setup

  1. Save and activate the flow
  2. In Auto-Merge Setup, go to the Overridden Fields section
  3. Add a new field:
    • For Field select a field name
    • For Strategy select Flow
    • For Flow select a custom field-value strategy flow
  4. Click Save

Select Flow As Field Value Strategy