繁体   English   中英

Microsoft Dynamics CRM 注释实体错误的“创建者”字段值

[英]Microsoft Dynamics CRM Annotation Entity wrong "Created by" Field value

我正在使用 Dynamics CRM 注释,我开发了一个使用组织服务的外部应用程序,以便创建链接到自定义实体并根据用户 ID 链接到用户的新注释,通过在组织服务中设置 CallerId 并通过在创建时在注释 object 中设置字段“CreatedBy”。

问题是注释有时“创建者”的值不正确,它是由另一个用户随机设置的。

下面使用的代码:

 Guid callerID = new Guid(HttpContext.Current.Request.QueryString["CallerId"].ToString());


 CrmServiceClient connection = new CrmServiceClient(connectionString);
 OrganizationServices = connection.OrganizationServiceProxy;
 OrganizationServices.CallerId = new Guid(callerID);
 .
 .
 .
 Entity Annotation = new Entity("annotation");
 Annotation.Attributes["objectid"] = new EntityReference("RelatedEntityLogical", RelatedEntity.Id);
 Annotation.Attributes["objecttypecode"] = RelatedEntity.LogicalName;
 .
 .
 .
 Annotation.Attributes["createdby"] = new EntityReference("systemuser", callerID);
 
 OrganizationServices.Create(Annotation);

有任何想法吗? 谢谢

也许试试这个:

不要设置createdby属性 - 即删除此行:
Annotation.Attributes["createdby"] = new EntityReference("systemuser", callerID);

直接在 CrmServiceClient 的实例上设置CallerId
connection.CallerId = new Guid(callerID);

直接从 CrmServiceClient 的实例调用Create
connection.Create(Annotation);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM