Using the After Index Search Plugin
After Index Search Plugin
This article explains how to extend Duplicate Check’s candidate record scoring process by implementing the After Index Search Plugin. You can use this plugin to run custom logic after Duplicate Check completes its index search but before duplicate scores are calculated—based on context provided by the system.
Overview
The After Index Search Plugin allows you to inject custom logic into the Duplicate Check flow once the initial candidate record set (from the index search) is obtained. This gives you the flexibility to:
- Add Records: Inject additional record IDs into the candidate list to ensure that important or related records are considered during score calculation.
- Remove Records: Filter out unwanted candidates (for example, inactive or low-value records) to fine-tune the duplicate matching process.
- Modify Candidate List: Adjust the list based on any custom business rules (e.g., weighting certain records, grouping, or additional filtering).
flowchart TD A[Duplicate Search Invoked] --> B[Index Search Completed] B --> C[Index Candidate Records Identified] C --> D[**Invoke After Index Search Plugin**: Add, Remove or Update Candidate Records] D --> E[Candidate Records Passed to Scoring]
Implementation
To implement the After Index Search Plugin, create an Apex class that implements the dupcheck.dc3PluginInterface
. The primary focus is on handling the INDEX_SEARCH_AFTER
event using a dedicated method.
global Object execute(dupcheck.dc3Plugin.PluginEventType eventType, Object eventData)
Step 1. Create Apex Class
Ensure your class is declared as global
so that it can be referenced by the Duplicate Check framework.
Step 2. Implement the `isAvailable` Method
eventType
: The event triggering the plugin. Check that it is'INDEX_SEARCH_AFTER'
.- This method returns true if the plugin should handle the given event.
Step 3. Implement the `execute` Method
- This method dispatches the event to a dedicated handler (e.g.,
handleIndexSearchAfter
). - Only events of type
INDEX_SEARCH_AFTER
are processed.
Step 4. Implement the `handleIndexSearchAfter` Method
- Receive an input instance of
dupcheck.dc3PluginModel.IndexSearchAfterInput
, which contains: - The list of candidate record IDs (output from the index search).
- Additional context such as the source record data and configured scenarios.
- Apply custom logic to modify the candidate list—such as adding or removing record IDs.
- Return an output of type
dupcheck.dc3PluginModel.IndexSearchAfterOutput
that contains the modified candidate IDs.
Step 5. Reference the Plugin in DC Settings
In your Salesforce org, navigate to the Duplicate Check Setup page and open the DC Settings section. Under the “After Index Search Plugin” field, enter the fully qualified name of your custom Apex class (e.g., AfterIndexSearchPlugin
). This registration ensures that the Duplicate Check framework uses your implementation to modify the candidate records.
Updated 17 days ago