How to synchronously generate match-code for duplicate detection rules?
As you know part of the CRM 4.0 “Data Management” features you have the possibility to create a “Duplicate Detection Rule”
The rule is specific for a certain entity and will create match-code based on the attributes selected.
· Please note that each entity can have only 5 duplicate detection rules
· The match code length cannot exceed 450 à Matchcode nvarchar(450)
· The job to create the match-code is run asynchronously (by default) by the CRM asynchronous service therefore there is a still a chance of having duplicate records if these records were created at the same time or within a time frame which falls before the match-code is generated for the affected records.
· Please note that the reason for generating match code asynchronously is to provide better performance
However if you wish to generate the match-code synchronously you can follow the below steps
· Create for example a duplicate detection rule for the Account email address
· Create a plug-in assembly
· Register the plug-in assembly as pre-create/pre-update synchronous for the account entity
Now when you create or update an account the match-code will be generated synchronously in case of a match the end user will be notified about it otherwise the record will be created as expected
Please note that using synchronous persistence of match codes will result in more accurate and timely duplicate detection results but will degrade the performance of the create or update operation