0

我为系统实体创建了一个自定义字段。如何通过后期绑定通过 XRM Web 服务访问属性值?

我正在使用这段代码,但它给了我EntityReference对象:

Entity objCase = service.Retrieve("incident", new Guid(Request.QueryString["EntityID"]), attributes);
string strValue = objCase.Attributes["new_papid"]).ToString();
4

1 回答 1

3

您正在检索查找值,在这种情况下,您需要先转换为实体引用

Entity objCase = service.Retrieve("incident", new Guid(Request.QueryString["EntityID"]), attributes);
EntityReference pap = (EntityReference)objCase.Attributes["new_papid"];
Guid papId = pap.Id; // ID of the record;
string papName = pap.Name; // Primary attribute of the entity;
于 2013-04-05T08:57:14.423 回答