我正在为 Microsoft Dynamics CRM 4 创建一个插件,它将根据另一个查找字段的值更改帐户实体的所有者。现在我已经设法获得将充当帐户“所有者”的用户的 GUID。到现在为止还挺好。当我尝试更改所有者时,问题就出现了。我正在尝试使用 AssignRequest 但它不起作用。当我尝试执行请求时,我在 C# 调试器上收到 SoapException,并且 Web 服务输出一个对话框,说明:“未找到请求的记录,或者您没有足够的权限查看它”
下面是我正在使用的代码:
TargetOwnedAccount target = new TargetOwnedAccount();
SecurityPrincipal assignee = new SecurityPrincipal();
assignee.Type = SecurityPrincipalType.User;
assignee.PrincipalId = context.InitiatingUserId;
target.EntityId = ownerGuid; //this is the GUID I am retrieving from the other lookup field
AssignRequest assign = new AssignRequest();
assign.Assignee = assignee;
assign.Target = target;
AssignResponse res = (AssignResponse)crmService.Execute(assign); //this is where i get the exception
我希望我没有错过任何东西。任何帮助将不胜感激:)谢谢