我正试图在关于PhoneCall活动领域保存领导者, 它给出了一个错误,如 - " aboutobjectid"只要。 [前提]
请帮助!
在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;
}
}
答案 0 :(得分:3)
将aboutobject传递为 EntityReference 是错误的。您应该传递线索 的EntityReference
Phone.Attributes["regardingobjectid"] = new EntityReference("lead", regardingobjectid);
同时检查潜在客户 ID的来源