开发者

Retrieving display value of lookup field in Dynamics CRM C# plugin

I am trying to retrieve the display value of a lookup field in a plugin for MS Dynamics CRM 4.0. The value of the attribute is a GUID whic开发者_JS百科h points to another entity (owner of salesorder in this case). "Normal" attributes I retrieve with a code like this:

CrmDateTime  serviceOrderDateDT = (CrmDateTime)entity["submitdate"];
                      serviceOrderDate = serviceOrderDateDT.Value.ToString();

Any ideas on how to do this for the display value of a lookup field?


Owner ownerLookup = (Owner)entity["ownerid"];
string ownerName = ownerLookup.name;


Actually, you need to cast that property to type Owner not Lookup, i.e.:

(Owner)entity["ownerid"]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜