我正在使用 Dynamics CRM 注释,我开发了一个使用组织服务的外部应用程序,以便创建链接到自定义实体并根据用户 ID 链接到用户的新注释,通过在组织服务中设置 CallerId 并通过在创建时在注释对象中设置字段“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);
有任何想法吗?谢谢