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 which 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;
实际上,您需要将该属性强制转换为Owner而不是Lookup类型,即:
(Owner)entity["ownerid"]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.