在Microsoft Dynamics CRM 2011中为LOOKUP字段添加值 [英] Adding value to LOOKUP field in microsoft dynamics crm 2011

查看:115
本文介绍了在Microsoft Dynamics CRM 2011中为LOOKUP字段添加值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Microsoft Dynamics CRM 2011的xrm服务更新帐户中的查找字段。

I need to update a look up field in account using xrm services of microsoft dynamics crm 2011.

需要一些想法。请。帮助

Need some ideas.Pls. Help

推荐答案

CRM 2011中的查找字段为 EntityReference ,这意味着您需要知道查找指向的实体的 LogicalName 和记录的 Id

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(可以使用简化连接作为此示例: https:/ /stackoverflow.com/a/15930366/2191473

Assuming you are already connected to CRM (you can use simplified connection as this example: 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);

在使用EntityReference设置查找字段并保存了记录。

you first get the record tu update, after set the lookup field with an EntityReference and after you save the record.

这篇关于在Microsoft Dynamics CRM 2011中为LOOKUP字段添加值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆