Input & Output
Determine master record
The getMergeMaster
method evaluates a list of Salesforce objects (SObject
) and determines which record would serve as the master record after a merge operation. The method returns an SObject
representing the master record based on the Plauti Deduplicate Merge Rules. This method is designed for preview purposes and does not perform the actual merge.
Method Signature
Method Name: getMergeMaster
SObject getMergeMaster(List<SObject> objectList)
Parameters
Type | Variable | Description |
---|---|---|
List<SObject> | objectList | A list of Salesforce objects as input |
Output
Type | Variable | Description |
---|---|---|
SObject | masterContact | The master record after the merge, including only fields updated per DC rules. |
Returns null if no master record is determined. |
Apex example
This snippet queries duplicate Contact records, initializes the Duplicate Check API, and determines the master record using the getMergeMaster
method. It logs the queried records, executes the master determination process, and outputs the identified master record or a message if no master record is found.
// Query the records to evaluate for merging
List<Contact> duplicateContacts = [
SELECT Id, LastModifiedDate // Query all fields used for determining the master record
FROM Contact
WHERE Id IN ('003J8000007jigQIAQ', '003J8000007jigRIAQ', '003J8000007jigUIAQ')
];
System.debug('Queried duplicate contacts: ' + duplicateContacts);
// Initialize the Duplicate Check API
dupcheck.dc3Api dc3Api = new dupcheck.dc3Api();
System.debug('Duplicate Check API initialized.');
// Execute the method to determine the master record
System.debug('Executing getMergeMaster to identify the master record...');
SObject masterContact = dc3Api.getMergeMaster(duplicateContacts);
System.debug('getMergeMaster method executed. Result: ' + masterContact);
// Log the master record if found
if (masterContact != null) {
System.debug('Master Record determined. Master Record ID: ' + masterContact.Id);
System.debug('Master Record Data: ' + masterContact);
} else {
System.debug('No master record could be determined.');
}
Updated 17 days ago