title: Dynamics CRM get selected entity's attribute value
body: <p>I need to get an attribute value ("val_index") of an entity which is selected in lookup.</p>
  
  <pre><code>function onLookupChange(){
      var entityName, entityId, entityLabel, lookupFieldObject;
  
      lookupFieldObject = Xrm.Page.data.entity.attributes.get('my_attribute');
      if (lookupFieldObject.getValue() != null) {
          entityId = lookupFieldObject.getValue()[0].id;
          entityName = lookupFieldObject.getValue()[0].entityType;
          entityLabel = lookupFieldObject.getValue()[0].name;
      }
      // here I need to get an attribute value of a selected entity. Attribute's name is "val_index"
  }
  </code></pre>
  
  <p>How can I do that?</p>