Input & Output
Calculate matching score
The matchRecord(SObject recordA, SObject recordB)
method evaluates the similarity between two Salesforce records based on the configured Plauti Deduplicate scenarios. It returns a numeric score indicating how closely the records match.
Method Signature
Method Name: matchRecord
static Integer matchRecord(SObject recordA, SObject recordB)
Parameters
Type | Variable | Description |
---|---|---|
SObject | recordA | The first record to compare. |
SObject | recordB | The second record to compare. |
- The records must belong to the same Salesforce object type (e.g.,
Contact
,Account
). - Both
recordA
andrecordB
must be queried to include (system) fields required for matching.
Output
- The method returns an
Integer
representing the similarity score betweenrecordA
andrecordB
.
Apex Example
This snippet retrieves two Contact records from Salesforce, logs their details, and then uses the matchRecord
method from the Duplicate Check API to compare them. It calculates and logs the matching score between the two records.
// Query the records to match
Contact recordA = [SELECT FirstName, LastName, Email FROM Contact WHERE Id = '003Aa00000XVeYCIA1'];
System.debug('Record A retrieved: ' + recordA);
Contact recordB = [SELECT FirstName, LastName, Email FROM Contact WHERE Id = '003Aa00000XWU9kIAH'];
System.debug('Record B retrieved: ' + recordB);
// Execute the matchRecord method
Integer matchingScore = dupcheck.dc3Api.matchRecord(recordA, recordB);
System.debug('Matching Score between recordA and recordB: ' + matchingScore);
Updated 15 days ago