Display tooltips for fields in MS CRM – Part 1

October 14, 2010 by  

There is simple way to set tooltip text for field on CRM form. You can do it with following script placed on OnLoad event handler of some CRM form:

crmForm.all.<field name>_c.title = 'Tooltip text';
crmForm.all.<field name>_d.title = 'Tooltip text';

It will be hard work to create detailed tooltips for all fields placed on form using this script. Andriy Butenko has developed a script which will set the fields tooltip based on description of the attribute in the metadata.



To make this possible copy following script to OnLoad event of the form:

gSetTooltips = function(){   

 Description: This function is used to set the tooltips based on the attributes desctiption in the metadata
 Returns:   nothing
 Example 1 :  gSetTooltips()
 Designed by:  Andriy Butenko (www.a33ik.blogspot.com)

 var request = "" +    
 "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +   
 "<soap:Envelope xmlns:soap=\'http://schemas.xmlsoap.org/soap/envelope/\'" +
 " xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\' xmlns:xsd=\'http://www.w3.org/2001/XMLSchema\'>" +   
 GenerateAuthenticationHeader() +   
 "  <soap:Body>" +     
 "    <Execute xmlns=\'http://schemas.microsoft.com/crm/2007/WebServices\'>" +   
 "      <Request xsi:type=\"RetrieveEntityRequest\">" +   
 "        <RetrieveAsIfPublished>true</RetrieveAsIfPublished>" +   
 "        <EntityItems>IncludeAttributes</EntityItems>" +   
 "        <LogicalName>" + crmForm.ObjectTypeName + "</LogicalName>" +   
 "      </Request>" +   
 "    </Execute>" +   
 "  </soap:Body>" +    
 var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");   
 xmlHttpRequest.Open("POST", '/mscrmservices/2007/MetadataService.asmx', false);   
 xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");   
 xmlHttpRequest.setRequestHeader("Content-Length", request.length);   
 var result = xmlHttpRequest.responseXML;   
 for(var i = 0; i < crmForm.all.length; i++)   
 if(crmForm.all[i].title != null && crmForm.all[i].title != 'undefined'){       
  var fieldName = crmForm.all[i].id;       
  var desc = result.selectSingleNode("//EntityMetadata/Attributes/Attribute[LogicalName='" + fieldName + "']/Description/UserLocLabel/Label");       
   if(desc != null){               
    crmForm.all[fieldName + '_c'].title = desc.nodeTypedValue;               
    //crmForm.all[fieldName + '_d'].title = desc.nodeTypedValue;            //activate this line if you want to display title on field as well
  catch(e) {}   

Related Posts:
Display tooltips for fields in MS CRM – Part 2
Display tooltips for fields in MS CRM – Part 3 (for CRM2011)


6 Comments on Display tooltips for fields in MS CRM – Part 1

    Andriy Butenko on Tue, 26th Oct 2010 22:56

    This is me =) I'm actually surprised. Thank you for the reference =)

    I'd like to find out more? I'd care to find out some additional information.

    velo hollandais assistance electrique gazelle on Sun, 13th Jul 2014 22:03

    Spot on with this write-up, I absolutely feel this website needs much more attention. I'll probably be
    returning to see more, thanks for the information!

    Martin on Tue, 23rd Sep 2014 19:26

    An impressive share! I have just forwarded this onto a colleague who
    was doing a little homework on this. And he in fact ordered me
    dinner because I discovered it for him… lol. So
    let me reword this…. Thank YOU for the meal!! But yeah, thanks for spending some time to talk
    about this subject here on your site.

    Www.exyudirectory.com on Sun, 28th Sep 2014 01:20

    I have learn some excellent stuff here. Definitely worth bookmarking for revisiting.
    I wonder how much attempt you put to create one of these fantastic informative
    web site.

    dissensus.net on Wed, 8th Oct 2014 17:09

    Whats up very nice blog!! Guy .. Beautiful ..
    Amazing .. I will bookmark your site and take the feeds also?

    I am happy to search out numerous useful info here
    in the put up, we'd like develop more strategies on this regard, thank you for sharing.
    . . . . .