添加注释
我试图通过代码添加注释,注释添加得很好,但它不会添加正确的 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 吗?
谢谢!
I am trying to add a annotation via code and the annotation adds fine but it won't add the correct CreatedBy user. It just adds the annotation and sets the createdby user to the admin. This is what I am using:
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);
Do you have to do anything special to add the CreatedBy?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能在“创建”或“更新”中设置“createby”。请参阅属性创建者的说明。它对于创建或更新无效。系统会将此属性设置给正在执行当前请求的用户。
您必须使用模拟以另一个用户的名义创建记录。因此,您必须将 CallerId 属性设置为您想要模拟的用户的 ID。请参阅使用 ActOnBehalfOf 权限进行模拟
You cannot set createdby in Create or Update. See the description for the attribute createdby. It is not valid for Create or Update. The system will set this attribute to the user which is executing the current request.
You have to use impersonation to create a record in the name of another user. Therefore you have to set the CallerId property to the id of the user which identity you would like to impersonate. See Impersonate Using the ActOnBehalfOf Privilege