Merge Rules

Last published at: 2023-10-05 08:59:47 UTC
Delete

Extensive Merge Rules are available in our Premium Edition. If you don't have a Premium subscription, feel free to apply for a trial.

When merging records within an object, Duplicate Check calls upon the Merge Rules to pick a master record and to determine what fields should be stored in that master record. The Merge Rules also determine what fields are pre-selected on the manual merge page, and the rules are executed when executing an automated merge. Learn how to configure the Merge Rules in this article.

Field Groups

Duplicate Check allows you to group fields, after which you can assign the group a single merge rule. As a result, the fields in a group are always kept together in a merge. So, for example, group the "email" and "email bounced reason" and make sure they always stay together. Or, decide to group a custom address field-set, which is then kept together always, even if one of the fields in the group is empty.

Master Record Rules

In the merge process, the master record is picked based on the master record rule. For example, you can determine the master record based on the record with the most fields populated or the record with the most attachments. In addition, new field expressions on a value based master record rule allow setting more advanced rules on text fields, such as "starts with", "ends with", or "like".

When deciding the master record based on a field and a field rule, a new rule is most common value. For example, decide that the master record has to be one of the records with the most common value in the "email" field.

Field Rules

Field rules can be set to decide what value to keep in a master record. In addition to the existing rules, we can now determine a master field value based on the most common value. For number fields, apply a math rule such as average, sum, multiply or subtract.

For multi-select picklists, we now offer the combine values rule, which combines the values of the records in a merge operation.

If you don't want to lose a value at all, field rules now support concatenation, or the keep all values option, which stores loser values to a mapped Long Text Area.

Decide if you want end-users to be able to change the master record

A new setting lets you decide if end-users working with the manual merge page are allowed to select a different master record. It could make sense to set a strict rule for defining the master record, which users are not able to bypass. You can now enforce this.

Let blank fields be potential winners

There is an option to "allow blank" for every field or group - allow a blank value. If set to true, a blank value can be chosen as a winning value in the master record if the merge rule points to that record and value.
If set to false, and a merge rule initially points to an empty field, the rule is re-applied to decide which field value from the remaining records is best suited to be used in the master record.
Note that partially-filled addresses (e.g. addresses with a city and zip code filled in but no street) are considered to be not empty.

Master Record Rule

The master record is determined based on a rule which can be set on the Merge Rule tab. The master record is the record that will be kept in Salesforce. If a particular rule is not able to determine a winning record, a fallback rule is set.

Master Record Rule Description Fallback Rule
Modified Date: Least Recent The record modified least recently is the master record. No
Modified Date: Most Recent The record modified most recently is the master record. No
Created Date: Least Recent  The record created least recently is the master record. No
Created Date: Most Recent The record created most recently is the master record. No
Record with the most populated fields The record with the most populated fields is the master record. Yes
Record with the most attachments The record with the most attachments is the master record. Yes
Field Based

The master record is determined based on a field and a field rule.

Most fields can be selected when setting up a field based rule*. Available field rules are linked to field types.

*Address-, Reference- and Multi-select picklist fields cannot be selected in field based master record rules.

Yes
Value Based

The master record is determined based on a field and a given value.

Most fields can be selected when setting up a value based rule*. After selecting a field, a value can be given.

*Address fields cannot be selected in value based rules.

Yes

Field Group Rules

 With the option to group fields, you gain the option to always keep them together in the merge operation since the fields are assigned the same rule. In addition, configure a group of fields always to keep all values or to divide values amongst the fields in the group.

Field Group Rule Description Fallback Rule
Master Record Rule The field group of the record selected in the master record rule is kept in the master record. No
Modified Date: Least Recent The field group of the record modified least recently is the group kept in the master record. No
Modified Date: Most Recent The field group of the record modified most recently is the group kept in the master record. No
Created Date: Least Recent The field group of the record created least recently is the group kept in the master record. No
Created Date: Most Recent The field group of the record created most recently is the group kept in the master record. No
Group with the most populated fields The field group of the record with the most populated fields is the group kept in the master record. Yes
Keep All Values Selecting "Keep All Values" will ensure that all loser records' field group values are stored in a given long text area. After selecting, the rule has to be configured in the modal.

Merge rule for deciding the value in the Master Record

A rule that decides what value is kept in the field group of the master record.

Store additional values in Long Text Area

Select a long text area field for storing the field group values of the loser records. It is recommended to create a dedicated field for each rule that stores values.

Values to store

Unique Values - Will only store values in the mapped long text area field that differ from those kept in the master record.

All Values - Will store all values, regardless of whether they are duplicates to the values kept in the master record.

*If the maximum character limit of the long text area is reached, the values are truncated at the end.

Delimiter

Choose a delimiter to separate the values in the long text area.

No
Divide Values

Selecting "Divide Values" will ensure that all values from master & loser records are divided over the fields in a group in the master record. Any additional fields are stored in a separate long text area field. After selecting, the rule has to be configured in the modal.

For example, group all email fields and apply "Divide values". Now, in a merge operation, all email values from all records are kept and divided over the email fields in the master record if they are empty. Any additional records are stored in the mapped long text area field.

Store additional values in Long Text Area

Select a long text area field for storing the additional field values that can't be stored in the fields in the field group due to a possible surplus. It is recommended to create a dedicated field for each rule that stores values.

Delimiter

Choose a delimiter to separate the values in the long text area.

No

Field Rules

For every field, a field rule can be assigned to determine based on what ground a value should be chosen over another value. A winning value can be determined based on record based rules or value based rules.

Record Based Description Fallback Rule
Master Record Rule  The value of the record selected in the master record rule is kept in the master record. No
Modified Date: Least Recent The value of the record modified least recently is kept in the master record. No
Modified Date: Most Recent The value of the record modified most recently is kept in the master record. No
Created Date: Least Recent The value of the record created least recently is kept in the master record. No
Created Date: Most Recent The value of the record created most recently is kept in the master record. No
Value Based Description Fallback Rule
Address that has the most fields populated

The address with the most populated fields is kept in the master record.

Available for field types: Address compound fields.

Yes
Most Common Value

The value most common in the group of records is kept in the master record.

Please note that null values are not considered in this rule.

Available for field types: Text, Text Area, Email, Phone, URL, Picklist, Currency, Geolocation, Number, Checkbox, Date, Date & Time, Time.    

Yes
Concatenate Values Combines the values of the master & loser records in the same field. After selecting, this rule has to be configured in the modal.
Concatenate

Unique Values - The value in the loser record(s) is compared with the value in the master record. Only if the loser record(s) value differs from the master record is it concatenated in the field.

All Values - All values from the loser records are concatenated in the field, even if the value is duplicate.

Delimiter

Choose a delimiter to separate the values in the long text area.

Available for field types: Text, Text Area.

No
Keep All Values

Keep all values of a specific field by storing values from the loser records in a secondary long text area. After selecting, the rule has to be configured in the modal.

Merge rule for deciding the value in the Master Record

Pick a rule that decides what value is kept in the master record.

Store additional values in (Long) Text Area

Select a Long Text Area field for storing the additional values. It is recommended to create a dedicated field for each rule that stores values.

Values to store

Unique Values - Will only store values in the mapped long text area field that differ from the value kept in the master record.

All Values - Will store all values, regardless of whether they are duplicates to the value kept in the master record.

Delimiter

Choose a delimiter to separate the values in the long text area.

Available for field types: Text, Text Area, Email, Phone, URL, Picklist, Currency, Geolocation, Number, Address.

Yes
Shortest Value

The value with the least characters will be kept in the master record. If there are two or more values with the same number of characters, the fallback rule will be applied.

Available for field types: Text, Text Area, Email, Phone, URL, Picklist. 

Yes
Longest Value

The value with the most characters will be kept in the master record. If there are two or more values with the same number of characters, the fallback rule will be applied.

Available for field types: Text, Text Area, Email, Phone, URL, Picklist. 

Yes
Highest in Picklist Order

The highest value in a picklist order selected in any of the records is kept in the master record.

Available for field types: Picklists.

No
Lowest in Picklist Order

The lowest value in a picklist order selected in any of the records is kept in the master record.

Available for field types: Picklists.

No
Minimum Value

The minimum value is kept in the master record.

Available for field types: Number, Percent, Currency.

No
Maximum Value

The maximum value is kept in the master record.

Available for field types: Number, Percent, Currency.

No
Sum

 Sums all values and stores the summed-up value in the master record.

Available for field types: Number, Currency.

No
Average

Takes the average of all values and stores the average value in the master record.

Available for field types: Number, Currency, Percent.

No
Multiply

Multiplies all values and stores the multiplied value in the master record.

Available for field types: Number, Currency.

No
Subtract

Sets all values from high to low and subtracts the values. The subtracted value is stored in the master record.

E.g., If record A has a value of 12, Record B has a value of 23, and record C has a value of 40, the subtracted value is 40 - 23 - 12 = 5.

Available for field types: Number, Currency.

No
True over False

Will keep a "true" value over a "false" value in the master record if it can be found in the records.

Available for field type: Checkbox.

No
False over True

Will keep a "false" value over a "true" value in the master record if it can be found in the records.

Available for field type: Checkbox.

No
Combine Values

Combines the values from a multi-select picklist that can be found in the records in the master record.

Available for field type: Multi-select Picklist.

No
Most Recent Value

Will keep the most recent value in the master record.

Available for field types: Date, Date & Time, Time, ID.

No
Least Recent Value

Will keep the least recent value in the master record.

Available for field type: Date, Date & Time, Time, ID.

No

Fallback Rule

 When assigning a rule that can't always pick a winning record, group, or value, a fallback rule is available for configuration. The fallback rule determines based on rules that are always able to pick that winning record, group, or value.

Fallback Rule Description
Master Record Rule The value of the record selected in the master record rule is kept in the master record.
Modified Date: Least Recent The value of the record modified least recently is kept in the master record.
Modified Date: Most Recent The value of the record modified most recently is kept in the master record.
Created Date: Least Recent The value of the record created least recently is kept in the master record.
Created Date: Most Recent  The value of the record created most recently is kept in the master record.

Fallback Rule Applies To

Decide to what records in the group the fallback rule should apply. For example, decide that the fallback rule should only apply to records that meet the criteria of the initial rule. Or decide that all records can be taken into account to determine a winner in this second step.

Delete

For example, when assigning the "Most Common Value" rule for the Email field, there may be two equally common email addresses. A fallback rule will then determine which of the two most common email addresses is stored in the master record when "Fallback Rule Applies To" is set to "Records selected by the initial rule".

Allow Blank

There is an option to "allow blank" for every field or group - allow a blank value. If set to true, a blank value can be chosen as a winning value in the master record if the merge rule points to that record and value.
If set to false, and a merge rule initially points to an empty field, the rule is re-applied to decide which field value from the remaining records is best suited to be used in the master record.
Note that partially-filled addresses (e.g. addresses with a city and zip code filled in but no street) are considered to be not empty.

Changing the master record in a manual merge

Decide if you want to allow end-users to manually change a master record in the manual merge page. If the toggle is set to true, users are allowed to make any changes they want. Set the toggle to false if you want to enforce the master record being selected based on the merge rule you set. As a result, changing the master record on the merge page is no longer possible.


Delete

If you want to make exceptions to what the Merge Rules can configure, take a look at our Merge Plugins. Use a Merge Plugin to execute custom Apex code before or right after a merge operation is done. Merge Plugins & Merge Rules can work together perfectly well.