我正在尝试在 Regarding Field of PhoneCall Activity 中保存 Lead Guid, 它给出了一个错误 - 仅“regardingobjectid”。 [前提]
请帮忙!
在 New_PhoneCall.cs 页面中:
PhoneCall_Save.regardingobjectid = Guid.Parse(hdnfld_regarding.Value);//(hdnfld_regarding 是一个隐藏字段,其中 m 传递 guid,我已经将其与文本框一起使用)
在 AppCode/CRMDMLibrary.cs 中:
public class PhoneEntity
{
public Guid regardingobjectid;
}
public bool SaveNewPhoneCall()
{
try
{
IOrganizationService Context = CRMDMLibrary.GetCRMService(url, DomainName, username, password);
Entity Phone = new Entity("phonecall");
Phone["regardingobjectid"] = new EntityReference("regardingobject", regardingobjectid);
Guid phoneid = Context.Create(Phone);
return true;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write(ex.Message);
HttpContext.Current.Response.End();
return false;
}
}
最佳答案
传递 regardingobject 作为 EntityReference 是错误的。你应该传递 lead 作为 实体引用
Phone.Attributes["regardingobjectid"] = new EntityReference("lead", regardingobjectid);
还要检查 lead id 的来源
关于c# - 从 CRM 门户 (2011) 保存相关属性(Lead_PhoneCall 事件)时出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27016346/