Quantcast
Channel: Magnetism Solutions Dynamics CRM Blog : microsoft dynamics
Viewing all articles
Browse latest Browse all 651

Ignoring Activated Duplicate Detection Rules using the Dynamics CRM SDK

$
0
0

When creating a new record using the CreateRequest, you can pass a parameter to the message to ignore the Activated Duplicate Detection rules. Rather than programmatically unpublishing related Duplicate Detection rules in a custom integration or migration tool, you can now keep your rules published and ignore the rules with a single line of code.

Let’s go through a typical scenario.

In Dynamics CRM, I have a published Detection Rule on the Account Entity as bellow:

Ignoring Activated Duplicate Detection Rules using the CRM SDK

If I run this below code the first time, a new record will be created:

Ignoring Activated Duplicate Detection Rules using the CRM SDK

Running the same code again will throw an exception by the CRM platform as shown in the screenshot below.

Ignoring Activated Duplicate Detection Rules using the CRM SDK

To ignore or suppress the active duplicate detection rules you can simply set the SuppressDuplicateDetection property to true.

Entity target = newEntity("account");
target["name"] = "I am a clone";
CreateRequest req = newCreateRequest();
req.Target = target;
req["SuppressDuplicateDetection"] = true;
CreateResponse response = (CreateResponse)_service.Execute(req); 

Note that the example above uses the CreateRequest, but we can also suppress duplicate detection rules for the UpdateRequest.


Viewing all articles
Browse latest Browse all 651

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>