简体   繁体   English

在microsoft dynamics crm 2011中为LOOKUP字段添加值

[英]Adding value to LOOKUP field in microsoft dynamics crm 2011

I need to update a look up field in account using xrm services of microsoft dynamics crm 2011. 我需要使用microsoft dynamics crm 2011的xrm服务更新帐户中的查找字段。

Need some ideas.Pls. 需要一些想法.Pls。 Help 救命

Lookup fields in CRM 2011 are EntityReference , this means you need to know the LogicalName of the entity the lookup is pointing and the Id of the record. CRM 2011中的查找字段是EntityReference ,这意味着您需要知道查找指向的实体的LogicalName和记录的Id

Assuming you are already connected to CRM (you can use simplified connection as this example: https://stackoverflow.com/a/15930366/2191473 ) 假设您已连接到CRM(您可以使用简化连接作为此示例: https//stackoverflow.com/a/15930366/2191473

you can set the lookup field using this syntax: 您可以使用以下语法设置查找字段:

Entity recordToUpdate = service.Retrieve("contact", contactId, new ColumnSet(true));
recordToUpdate["parentcustomerid"] = new EntityReference("account", accountId);
service.Update(recordToUpdate);

you first get the record tu update, after set the lookup field with an EntityReference and after you save the record. 在使用EntityReference设置查找字段并保存记录之后,首先获取记录tu更新。

1) Download the Developer Toolkit for CRM 2011. 1)下载适用于CRM 2011的Developer Toolkit

2) Follow the directions to develop and deploy a plugin solution 2)按照说明开发和部署插件解决方案

The toolkit contains templates for plugins similar to the one you require. 该工具包包含与您需要的插件类似的插件模板。 Guido's answer for the actual lookup modification is correct. Guido对实际查找修改的回答是正确的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM