【问题标题】:Adding Annotation添加注释
【发布时间】:2011-12-29 20:59:32
【问题描述】:

我正在尝试通过代码添加注释,注释添加得很好,但它不会添加正确的 CreatedBy 用户。它只是添加注释并将 createdby 用户设置为管理员。这是我正在使用的:

Entity annotation = new Entity("annotation");
annotation["createdby"] = new EntityReference("systemuser", new Guid("2a213502-db00-e111-b263-001ec928e97f"));
annotation["objectid"] = new EntityReference("opportunity", opportunityId);
annotation["subject"] = "Lead Note";
annotation["notetext"] = p.Column_18;
Guid annotationId = lService.Create(annotation);

添加 CreatedBy 需要做一些特别的事情吗?

谢谢!

【问题讨论】:

    标签: dynamics-crm dynamics-crm-4 dynamics-crm-2011


    【解决方案1】:

    您不能在 Create 或 Update 中设置 createdby。请参阅属性 createdby 的描述。它对创建或更新无效。系统会将此属性设置为正在执行当前请求的用户。

    您必须使用模拟来以其他用户的名义创建记录。因此,您必须将 CallerId 属性设置为您想要模拟的身份的用户的 id。见Impersonate Using the ActOnBehalfOf Privilege

    【讨论】:

      猜你喜欢
      • 2011-04-30
      • 2014-04-02
      • 2012-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多