如何在 crm 4.0 上设置特定选项列表值?
我尝试在添加新帐户时设置我的选项列表的选定值。我的代码是:
CrmService service = connectToCrm();
PropertyCollection Prop = new PropertyCollection();
DynamicEntity Firma = new DynamicEntity();
// set table
Firma.Name = EntityName.account.ToString();
StringProperty accountName = new StringProperty();
accountName.Name = "name";
accountName.Value = aDict["name"].ToString();
Prop.Add(accountName);
StringProperty vendorCode = new StringProperty();
vendorCode.Name = "new_bayikodu";
vendorCode.Value = aDict["new_bayikodu"].ToString();
Prop.Add(vendorCode);
StringProperty VD = new StringProperty();
VD.Name = "new_taxoffice";
VD.Value = aDict["new_taxoffice"].ToString();
Prop.Add(VD);
StringProperty VN = new StringProperty();
VN.Name = "accountnumber";
VN.Value = aDict["accountnumber"].ToString();
Prop.Add(VN);
StringProperty address = new StringProperty();
address.Name = "address1_line1";
address.Value = aDict["address1_line1"].ToString();
Prop.Add(address);
StringProperty tel = new StringProperty();
tel.Name = "telephone1";
tel.Value = aDict["telephone1"].ToString();
Prop.Add(tel);
StringProperty accountEmail = new StringProperty();
accountEmail.Name = "emailaddress1";
accountEmail.Value = aDict["emailaddress1"].ToString();
Prop.Add(accountEmail);
Firma.Properties = Prop;
Guid CustomerGuid = service.Create(Firma);
示例我想将城市选项列表设置为“伊斯坦布尔” 我可以使用 picklistproperty 吗?
i try to set selected value of my picklist while adding a new account.My code is :
CrmService service = connectToCrm();
PropertyCollection Prop = new PropertyCollection();
DynamicEntity Firma = new DynamicEntity();
// set table
Firma.Name = EntityName.account.ToString();
StringProperty accountName = new StringProperty();
accountName.Name = "name";
accountName.Value = aDict["name"].ToString();
Prop.Add(accountName);
StringProperty vendorCode = new StringProperty();
vendorCode.Name = "new_bayikodu";
vendorCode.Value = aDict["new_bayikodu"].ToString();
Prop.Add(vendorCode);
StringProperty VD = new StringProperty();
VD.Name = "new_taxoffice";
VD.Value = aDict["new_taxoffice"].ToString();
Prop.Add(VD);
StringProperty VN = new StringProperty();
VN.Name = "accountnumber";
VN.Value = aDict["accountnumber"].ToString();
Prop.Add(VN);
StringProperty address = new StringProperty();
address.Name = "address1_line1";
address.Value = aDict["address1_line1"].ToString();
Prop.Add(address);
StringProperty tel = new StringProperty();
tel.Name = "telephone1";
tel.Value = aDict["telephone1"].ToString();
Prop.Add(tel);
StringProperty accountEmail = new StringProperty();
accountEmail.Name = "emailaddress1";
accountEmail.Value = aDict["emailaddress1"].ToString();
Prop.Add(accountEmail);
Firma.Properties = Prop;
Guid CustomerGuid = service.Create(Firma);
Example i want to set city picklist to "istanbul"
can i use a picklistproperty ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是SO中提出的类似问题: 使用以下命令设置 BusinessEntity 选择列表值CRM 4.0 Web 服务
请注意,要在实体上设置选项列表属性,您需要知道要选择的选项列表项的值。该值属性的类型为整数。您可能需要查看 CRM 中的属性架构才能获取该值。或者,如果此自定义将安装在多个组织中,并且您认为此值可能会更改,则您可能需要检索属性元数据并根据名称以编程方式确定正确的项目。 (第二个解决方案并不理想,因为选项列表“名称”可能会更新,因此会破坏您的代码)。
Here is a similar question asked in SO: Setting BusinessEntity picklist value using CRM 4.0 webservice
Please note that to set a picklist property on an entity, you need to know the value of the picklist item you wish to choose. This value property is of type integer. You may need to look at the attribute schema from within CRM to get this value. Or alternatively if this customization is going to be installed in multiple organizations and you believe this value might change, then you may need to retrieve the attribute metadata and determine the correct item programmatically based on the name. (This 2nd solution is not ideal as the picklist 'name' could be updated and would therefore break your code).
然后您可以使用“城市”来设置您的选择列表。
Then you can use 'city' to set your picklist.