Using the Prevention Interface

Prevention plugin

You can use this interface to run custom logic immediately when a record is created or updated via API, and assign a status to the record.

Overview

The Plauti Deduplicate Prevention Interface lets you run custom logic on record creation or update. Initially, the plugin determines the record’s source. It then assigns an in-between status: WEB2LEAD for web-to-lead records, DELTA for API inserts, or DIRECT when only direct processing is enabled. After this, a duplicate comparison is performed and the record is finalized with either a UNIQUE or DUPLICATE status.

flowchart TD
  A[Record Inserted or Updated] --> B{Determine Source}
  B -- Web-to-Lead Checkbox = True --> C[Assign Status: WEB2LEAD]
  B -- API Insert Enabled --> D[Assign Status: DELTA]
  B -- Direct Processing Only --> E[Assign Status: DIRECT]
  
  C --> F[Run Duplicate Comparison]
  D --> F
  E --> F

  F --> G{Duplicates Found?}
  G -- Yes --> H[Assign Status: DUPLICATE]
  G -- No --> I[Assign Status: UNIQUE]

Implementation

To implement the Prevention Interface, create an Apex class that implements the dupcheck.dc3Plugin.InterfacePrevention interface. The primary method to implement is:

processStatus(Set<Id> recordIdSet, dc3Plugin.PreventionStatus status)
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 `processStatus` Method
  • recordIdSet: A set of record IDs that should receive the new status.
  • status: The status to be assigned to these records. This status may be one of the following: UNIQUE, DUPLICATE, DELTA, WEB2LEAD, or DIRECT.
Step 3. Insert Custom Logic

Use the passed metadata (the set of record IDs and the status) to drive your custom behavior. For example, you might update a custom field on the records, trigger notifications, or perform additional validations.

Step 4. Reference the Plugin in DC Settings

In your Salesforce org, navigate to the Duplicate Check Setup page, then open the DC Settings section.


Under the "Prevention Plugin" field, enter the name of your custom Apex class (e.g., DefaultPrevention). This registration ensures that the Duplicate Check framework uses your implementation during record creation and update operations.

Status values

The following status values may be assigned to records through the Prevention Interface. The status value calculated by the Prevention plugin is not automatically stored in a dedicated field by the Duplicate Check framework. Instead, it is returned as part of the plugin’s processing so that your custom logic can decide how to use or persist it. For example, you might update a custom field on the record or log the status in an audit log.

Status ValueDescription
UNIQUEEnd-status: Indicates that no duplicates were found.
DUPLICATEEnd-status: Indicates that duplicates were found.
DELTAIn-between status: Indicates that the record is processed via API Single Insert or API Bulk Insert, and is awaiting further duplicate comparison.
WEB2LEADIn-between status: Indicates that the record was created via a web-to-lead form (How to set up web-to-lead duplicate prevention) and is pending evaluation.
DIRECTIn-between status: Indicates that the record, processed via an API or automated process, is awaiting comparison. The DIRECT status is only given when API Single Insert and API Bulk Insert is disabled.

📘

The Prevention Plugin & the "Disable Duplicate Check" checkbox.

Enabling the "Disable Duplicate Check" checkbox lets you bypass duplicate blocking during record creation. Even though the record is allowed to be created, it will still be flagged as DUPLICATE—keeping your duplicate tracking intact while streamlining the process.