Change Lookup Text – Originating Lead field

Some clients like to have other text shown on the lookup fields, that’s the example on the Originating Lead field that links a Lead to an Opportunity (and Accounts and Contacts), because the lookup field in the Opportunity shows the Contact name (if the contact field is filled in the Lead), if not, then the lookup field appears to be empty.

So this is a code that will allow you to change the text to anything that you want/need. In our case it was the name of the Lead (subject field).

function ChangeLookUpDisplayValue()
 var lookupData = new Array();
 var lookupItem= new Object(); 
 if(Xrm.Page.getAttribute("originatingleadid") != null)
   var lookup = Xrm.Page.getAttribute("originatingleadid").getValue(); 
   if (lookup != null)
   { = lookup[0].id; 
     lookupItem.typename = lookup[0].typename;
     var displayvalue='';
     var fetchXml =
       "<fetch mapping='logical'>" +
        "<entity name='lead'>" +
         "<attribute name='subject'/>" +
        "<filter>" +
         "<condition attribute='leadid' operator='eq' value='" + + "' />" +
        "</filter>" +
        "</entity>" +

     var retrievedLead = XrmServiceToolkit.Soap.Fetch(fetchXml);
     if(retrievedLead != null)
       if (retrievedLead.length == 1)
          displayvalue = retrievedLead[0].attributes['subject'].value;
 = displayvalue;
          lookupData[0] = lookupItem;

Hope this helps.


User does not have send-as privilege for. – CRM 2015

Our client started to use the Server Side Sync via CRM and have some workflows that send emails.
The field From in the email is a system user (Admin) that sends emails to users. We thought that adding the the option to “send as” would work but, actually didn’t.user-options


So we decided to add the option in the Security Rolls that allows to send email as another user (Business Management -> Miscellaneous Privileges)


This allowed the email to be created and sended from CRM.


Hope this helps!