在插件中创建帐户时忽略 CRM 中的重复删除规则
Ignore Duplicate Dection Rules in CRM upon Creation of an Account Within Plugin
我正在尝试在 Qualification Event Plugin 中创建一个帐户。如果我创建的帐户名称与现有帐户的名称完全匹配,我的重复检测规则就会启动,并引发异常。
据我了解,重复检测规则始终是警告,而不是错误,并且默认情况下,当 运行 来自 Plugin/SDK 调用时,您不会收到任何错误甚至通知是这个CRM 的新变化?有没有办法从插件中忽略重复检测规则?
显然您必须在创建请求中设置“SupressDuplicateDetection”属性:
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);
这是有意的,并且显然是基于 MSDN 文档Run duplicate detection(早在 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.
假设 false 是布尔值的默认值。
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.
我正在尝试在 Qualification Event Plugin 中创建一个帐户。如果我创建的帐户名称与现有帐户的名称完全匹配,我的重复检测规则就会启动,并引发异常。
据我了解,重复检测规则始终是警告,而不是错误,并且默认情况下,当 运行 来自 Plugin/SDK 调用时,您不会收到任何错误甚至通知是这个CRM 的新变化?有没有办法从插件中忽略重复检测规则?
显然您必须在创建请求中设置“SupressDuplicateDetection”属性:
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);
这是有意的,并且显然是基于 MSDN 文档Run duplicate detection(早在 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.
假设 false 是布尔值的默认值。
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.