Dynamics CRM获取扩展属性
问题描述:
我已经为系统实体创建了一个自定义字段。 如何通过延迟绑定通过XRM Web服务访问属性值?Dynamics CRM获取扩展属性
我使用这个代码,但它给了我EntityReference
对象:
Entity objCase = service.Retrieve("incident", new Guid(Request.QueryString["EntityID"]), attributes);
string strValue = objCase.Attributes["new_papid"]).ToString();
答
您检索查找值,在这种情况下,你需要先转换为实体引用
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;