Вопрос:

Ignore Duplicate Dection Rules in CRM upon Creation of an Account Within Plugin

dynamics-crm-online dynamics-crm-2016

320 просмотра

2 ответа

14750 Репутация автора

I'm attempting to create an account within a Qualification Event Plugin. If I am creating an account with a name that matches exactly a name of an existing account, my Duplicate Detection Rule kicks in, and causes an exception to be thrown.

It was my understanding that duplicate detection rules were always warnings, not errors, and by default, you wouldn't get any errors or even notifications when running from a Plugin/SDK call Is this a new change to CRM? Is there a way to ignore Duplicate Detection Rules from a plugin?

Автор: Daryl Источник Размещён: 22.08.2016 09:13

Ответы (2)


3 плюса

14750 Репутация автора

Apparently you have to set the "SupressDuplicateDetection" Attribute in the create request:

Entity target = new Entity("account");
target["name"] = "I am a clone";
CreateRequest req = new CreateRequest();
req.Target = target;
req["SuppressDuplicateDetection"] = true;
CreateResponse response = (CreateResponse)_service.Execute(req); 
Автор: Daryl Размещён: 22.08.2016 09:13

2 плюса

14839 Репутация автора

Решение

This is intended, and apparently long standing behaviour based on MSDN documentation Run duplicate detection (listed as far back at CRM 2011).

Pass the duplicate detection optional parameter SuppressDuplicateDetection by adding a value to the Parameters property of the CreateRequest and UpdateRequest message requests. The SuppressDuplicateDetection parameter value determines whether the Create or Update operation can be completed:

  • true – Create or update the record, if a duplicate is found.
  • false - Do not create or update the record, if a duplicate is found.

Assuming false is the default as its a bool.

If the duplicate detection optional parameter is set to false and a duplicate is found, an exception is thrown and the record is not created or updated.

Автор: James Wood Размещён: 22.08.2016 09:51
Вопросы из категории :
32x32