Using the Set Field Value in Merge Plugin
Set Field Value in Merge
This article explains how to extend Plauti Deduplicate's merge functionality by implementing the Merge Set Field Plugin. You can use this interface to alter the field selection during a merge operation by specifying, via code, which record’s field value should be used or by setting custom values for individual fields.
Overview
The Merge Set Field Plugin lets you programmatically determine which field values should be used during a merge operation. The plugin receives as input the field selection for each field as determined by the DC Merge Rules. By implementing this interface, you can override the default selection—for example, by specifying that a particular record’s field value should be used if it meets a certain condition, or by setting a completely custom value.
In manual merge scenarios, the Merge Set Field Plugin is triggered after the merge process starts but before the manual merge interface is shown. This means that even if your custom logic alters the field selection, the user still has the option to override that decision during a manual merge. To enforce your custom logic strictly, consider writing the set field value logic in the BeforeMerge
plugin.
Implementation
To implement the Merge Set Field Plugin, create an Apex class that implements the dupcheck.dc3PluginInterface
interface. The Merge Set Master and Merge Set Field functionality must be executed within the Generic Plugin. The primary method to implement is:
mergeSetField(dupcheck.dc3PluginModel.MergeSetFieldInput input)
Step 1. Create Apex Class
Ensure your class is declared as global
so that it can be referenced by the Plauti Deduplicate framework.
Step 2. Implement Merge Set Field Logic
objectPrefix
: The 3-character identifier that denotes the record type (for example, '00Q' for Leads).objectDataList
: A collection of candidate records that are eligible to be merged.- Logic:
- For example, chose a valid email address over an invalid email address.
- Pick the phone number from a record that has at least one call log.
- Pick Lead Status "Web" over "Phone", over "Event".
Step 3. Reference the Plugin in DC Settings
In your Salesforce org, navigate to the Deduplicate Setup page, then open the DC Settings section.Under the “Generic Plugin” field, enter the name of your custom Apex class. This registration ensures that the Plauti Deduplicate framework uses your custom logic during merge operations.
Merge Flow
flowchart TB A([Merge is initiated]) --> B[Merge Rules] B --> C[Set Master Plugin] C --> D[**Set Field Plugin**] D --> E{Manual Merge?} E -- "Yes" --> F[Merge page invoked - User can override Merge Rules, Set Master and Set Field Plugin] F --> G([User Clicks Merge]) G --> H[Invoke BeforeMerge] E -- "No" --> H H --> I[MERGE EXECUTED] I --> J{Merge Successful?} J -- "Yes" --> K[Invoke AfterMerge] J -- "No" --> L[Invoke MergeFailed] K --> M L --> M[Merge Process Completed]
Updated 17 days ago