title: get a value from lookup field in crm 2015 using javascript
body: <p>i can get the id of the contact but who i get the email of this contact ?????</p>
  
  <pre><code>function getdata(){
  var entityName, entityId, entityLabel, lookupFieldObject;
  
      // parentaccountid is the lookup field name that we try to reach its values
      lookupFieldObject = Xrm.Page.data.entity.attributes.get('mbmhr_employee');
      if (lookupFieldObject.getValue() != null) {
          entityId = lookupFieldObject.getValue()[0].id;
          entityName = lookupFieldObject.getValue()[0].entityType;
          entityLabel = lookupFieldObject.getValue()[0].name;
  
  Xrm.Page.getAttribute("mbmhr_test22").setValue(entityLabel );    
  
      }    
  }
  </code></pre>