In the sales process normally, you would create a lead and then
promote that lead to an opportunity by clicking on the qualify button. When this
happens, the CRM creates an opportunity and a contact record.
If there are duplicate detection rules created for the
contact record, when you try to qualify a lead it would first bring a small
dialog box stating that there could be potential duplicates (Displays both
account and contact lookups) and to select one from the list.
One thing is that this appears even if there are no duplicate
records as well. If you unpublish the duplicate rules for contact, then this
dialog box doesn’t come up. If the rules might be needed we cannot unpublish
them.
Some clients don’t like this at all as it doesn’t give a
user friendly box with potential duplicates are being marked. Also even though there
are no duplicates this might pop up.
Luckily we can turn this off by writing a plugin.
The plugin has to be using the “Lead Qualify” message and
have to write for the pre validation stage of lead.
In the C# code you need to write the below twice.
localContext.PluginExecutionContext.InputParameters[“SurpressDuplicateDetection”]
= true;
localContext.PluginExecutionContext.InputParameters[“SurpressDuplicateDetection”]
= true;
This would prevent from displaying the dialog box
completely.
If you want to show the dialog box, if there are duplicates
then you can write code to check for duplicates based on the criteria you have
been given. Then only if there is a duplicate, you can display the dialog by
putting the below 2 statements in an if else condition.