locked
lookup field typename is undefined. RRS feed

  • Question

  •   when i use this code : Xrm.Page.getAttribute("XXXXXX").getValue()[0].typename

      I got a error :  typename is undefined.

      but the field have a value.

    Friday, July 8, 2016 9:13 AM

All replies

  • Try;

    Xrm.Page.getAttribute("lookupid").getValue()[0].entityType

    Saturday, July 9, 2016 12:14 AM
  • Instead of “typename”  please use “entityType” as shown in the below code.
     
    // contactid is the lookup field
        lookupFieldObject = Xrm.Page.data.entity.attributes.get('contactid');
        if (lookupFieldObject.getValue() != null) {
            entityId = lookupFieldObject.getValue()[0].id;
            entityName = lookupFieldObject.getValue()[0].entityType;
            entityLabel = lookupFieldObject.getValue()[0].name;
        }
     

    Hope this help.

    Thanks,

    Sam


    Inogic | Blog | news@inogic.com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Monday, July 11, 2016 12:49 PM