亲爱的智能开发人员,
当我想通过web服务在Microsoft 2013中创建属于某个组织的联系人时,我遇到了一个问题
client = new OrganizationServiceClient("CustomBinding_IOrganizationService");
var newContactProperties = new Dictionary<string, object> {
{ "lastname", "TestContact"},
{ "firstname", "A"},
{ "fullname", "A TestContact"}
};
/* organizationType is a CRM.CRMWebServices.OptionSetValue
* with ExtensionData null, PropertyChanged null and a valid Value
*
* orgReference is a CRM.CRMWebServices.EntityReference
* with a valid Id
*/
newContactProperties.Add("parentcustomeridtype", organizationType);
newContactProperties.Add("parentcustomerid", orgReference);
var entity = new Entity();
entity.LogicalName = "contact";
entity.Attributes = new AttributeCollection();
entity.Attributes.AddRange(newContactProperties);
client.Create(entity);这给了我一个错误:如果属性parentcustomerid不是NULL,那么属性parentcustomeridtype就不能为NULL。
我不明白为什么会发生这种情况,以及如何解决这个问题。如果可以的话请帮帮我。
谢谢你,AllWorkNoPlay
发布于 2014-12-10 18:03:53
您不需要单独设置"parentcustomeridtype“属性。它是一个系统字段,将由平台设置,并且由于遗留原因而存在于父客户端,在Dynamics的早期版本中它是客户类型。您只需要在查找字段中指定EntityReference。
newContactProperties.Add("parentcustomerid", new EntityReference("account", new Guid("{accountid guid}")));
此外,还不清楚在"orgReference“字段中使用的是哪种类型。对于联系人,有效的实体类型应该是“帐户”或“联系人”。
发布于 2014-12-15 08:50:48
谢谢你的回答,我没有设法用这种方式使用web服务。
我尝试过成功地使用早期绑定访问:
https://stackoverflow.com/questions/27373906
复制相似问题