Monday, July 9, 2012

How to get lookup Text value / Id in CRM 2011


Code Snippet:

var lookupObject = Xrm.Page.getAttribute("yourlookupattributename");

    if (lookupObject != null)
  {

        var lookUpObjectValue = lookupObject.getValue();

        if ((lookUpObjectValue != null))
        {

         var lookuptextvalue = lookUpObjectValue[0].name;

         var lookupid = lookUpObjectValue[0].id;

        }

  }

No comments:

Post a Comment