This sample shows how to invoke duplicate detection for creating and updating table records.
See How to run samples for information about how to run this sample.
The DuplicateRule
method is intended to be used in a scenario where it contains data that is needed to create duplicate detection rule.
In order to simulate the scenario described in What this sample does, the sample will do the following:
- Checks for the current version of the org.
- The
Account
method creates an account record. - The
DuplicateRule
method creates a duplicate detection rule. - The
DuplicateRuleCondition
method creates a duplicate detection rule conditions. - The
PublishDuplicateRuleRequest
method publishes the duplicate detection rule created earlier. You need to wait for publishing operation to complete, so we keep polling the state of the rule until it becomesPublished
.
- The
Account
method creates an account record. - The
CreateRequest
method creates operation by suppressing duplicate detection. - The
UpdateRequest
method updates the retrieved account record with new account number.
Displays an option to delete all the data created in the sample. The deletion is optional in case you want to examine the data created by the sample. You can manually delete the data to achieve same results.