Display tooltips for fields in MS CRM – Part 3 (for CRM2011)
Last year I blogged twice about how to dynamically create tooltips in MS CRM. Today I want to share with you a post on how to do this in CRM2011 using jQuery and an XML webresource in which you can specify tooltips per entity and fields. The function below reads the xml file and displays a help image and tooltip for each field specified in the xml webresource. (see screenshot).
Step-by-step
First create an XML webresource and give it a descriptive name (e.g. cm_xmlhelpfile).
<help> <entity name="account"> <attribute name="accountnumber"> <shorthelp>This is the SAP accountnumber</shorthelp> </attribute> </entity> </help>
Next add the latest version of jQuery to the webresources and add another webresource to include the function below and call it in the onload event.
//****************************************************
jQueryLoadHelp=function(filename, bDisplayImg) {
/*
This function is used add tooltips to any field in CRM2011.
This function requires the following parameters:
filename : name of the XML webresource
bDisplayImg: bolean to show/hide the help image (true/false)
Returns: nothing
Example: jQueryLoadHelp('cm_xmlhelpfile', true);
Designed by: http://lambrite.com/?p=221
Adaptd by Geron Profet (www.crmxpg.nl)
*/
if (typeof jQuery == 'undefined') {
alert('jQuery is not loaded.\nPlease ensure that jQuery is included\n as webresource in the form load.');
return;
}
$.ajax({
type: "GET",
url: "../WebResources/"+filename,
dataType: "xml",
success: parseHelpXML
}); //end ajax
//****************************************************
function parseHelpXML(data) {
var entity = Xrm.Page.data.entity.getEntityName().toString().toLowerCase();
entXML = $("entity[name=" + entity + "]", data)
$(entXML).children().each(function (i) {
var attr = this.getAttribute("name");
var txt = $(this).find('shorthelp').text();
registerHelp(entity, attr, txt);
});
}
//****************************************************
function registerHelp(entity, attr, txt) {
var obj = document.getElementById(attr+'_c').children[0];
html = '<img id="img_' + attr + '" src="/_imgs/ico/16_help.gif" alt="'+txt+'" width="16" height="16" /><div id="help_' + attr + '" style="visibility: hidden; position: absolute;">: ' + txt + '</div>';
$(obj).append(html);
//20110909 GP: added line to hide/show help image
document.getElementById('img_'+attr).style.display = (bDisplayImg) ? 'inline' : 'none';
}
}
The end result should look something like this:
Thanks to http://lambrite.com for the original design and sharing this.
Related Posts:
Display tooltips for fields in MS CRM – Part 1
Display tooltips for fields in MS CRM – Part 2
Conditionally enable/disable buttons in CRM2011 ribbon
Found this interesting post by (Vikranth Pandiri) about how to conditionally enable/disable buttons in a CRM2011 ribbon based on a value of a field on your form. Instead of using JavaScript you can set these rules directly in the ISV.Config.
See the complete post on howto-mscrm.blogspot.
Error: The given key was not present in the dictionary
Today I had the following error "The given key was not present in the dictionary" in MS CRM when opening an associated view.
![]()
Searching for a solution I came accross many blogs indicating that plugins might be the cause.
As it turned out I had deleted a picklist option from the entity without reassigning the existing data to a new option value. Thanks to Daniel Cai for pointing me in the right direction.
Maximum of 5000 responses from a FetchXml
Recently I was working with the Periodic Workflow Tool. I tried to run some workflows on an imported record set (about 26.000 records). This all seemed to work fine, but later we discovered that the workflows didn't run on all the records…
Soon I discovered that only the first 5000 records in the view were processed, after that it just stopped.
I checked the source code of the Periodic Workflow Tool, but I couldn't find a limit of 5000 anywhere and had to look further.
I came across this Microsoft article. In this article is explained that FetchXml works with paging and that it the maximum number of results can be adjusted.
My winning combination:
- Click Start, click Run, type regedit in the Open box, and then click OK.
- Locate and then select the following registry subkey:
HKEY_LOCAL_MACHINE\Software\Microsoft\MSCRM- On the Edit menu, point to New, and then click DWORD Value.
- Type TurnOffFetchThrottling, and then press ENTER.
- Right-click TurnOffFetchThrottling, and then click Modify.
- Type a number other than 0 in the Value data box, and then click OK.Note Step 6 lets you retrieve the number of records specified in the Count attribute of your fetch statement.
- On the File menu, click Exit.
Nassi-Schneiderman stencil for MS Visio 2007
Contrary to what I usually write about, I’m posting an article today about MS Office Visio shapes. In particular Nassi-Schneiderman which is very helpful in designing software/business processes that contain multiple decision steps, case-statements, loops etc..
| Source: www.edrawsoft.com |
Unfortunately, this template is no longer available by default in MS Office Visio 2003/2007 but after searching the Internet I came across this site: http://users.tm.net/tonietienne. From here you can download the Nassi-Schneiderman stencil and two templates (optional).
Visio 2003:
Download the stencil to C:\Program Files\Microsoft Office\Templates and rename to Nassi-Schneiderman.vss (change the extension to .vss).
Visio 2007:
Download the stencil to ..\My Documents\My Shapes and rename to Nassi-Schneiderman.vss (change the extension to .vss). From the menu, select File, Shapes, My Shapes.
Find out more about Nassi-Schneiderman on wikipedia and www.smartdraw.com.
Error loading external JavaScript file on Win2k8, IIS7.0
I’m using the following code in the entity’s OnLoad event to load an external JavaScript file in MS CRM.
===================================
function LoadFile(url, cache)
{
var httpRequest = new ActiveXObject('Msxml2.XMLHTTP');
httpRequest.open('GET', url, false);
if (!cache) {
httpRequest.setRequestHeader('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT');
}
httpRequest.send(null);
return httpRequest.responseText;
}
LoadFile('/ISV/scripts/accounts.js', false)
We recently migrated our CRM Server to Windows 2008, with IIS 7.0.
This worked fine on Windows 2003 and IIS 6.0, but on Windows 2008 and IIS 7.0, we get the following error:
Apparently the error is caused by the header If-Modified-Since and it turned out, the date should have a starting zero in it (01, not 1), see line 07.
httpRequest.setRequestHeader('If-Modified-Since', 'Sat, 01 Jan 2000 00:00:00 GMT');
The script has been tested and now works on both Win2k3 and Win2k8.
I want to thank Jevgenij Martynenko for finding this out and sharing it online.
Outlook 2011 configuration issue
Last week I installed Microsoft Dynamics CRM 2011 for Microsoft Office Outlook and encountered a peculiar issue. The installation went just fine, but when I tried to add an organization within the configuration wizard I received an error message. When I press "Test connection", it worked just fine, but when I press on OK, it keeps giving the message "The server address (URL) is not valid". To fix this, add an extra entry with the server's IP address and servername to the hosts file on your client machine located in "C:\Windows\System32\drivers\etc\hosts". I ran the configuration wizard again and now the organization was added succesfully.
Remarks: This issue will most probably appear when your computer is not part of the same domain as your CRM 2011 server.
Source: http://gustafwesterlund.blogspot.com/2010/12/crm-2011-release-candidate-and.html
Dynamically make a field required or recommended
This function can be used to dynamically make a field required or recommended in JavaScript. Copy the function below in the onload and call it using one the examples in the comments section.
//****************************************************
gSetFieldRequired = function (field, src, height, width){
/*
Description: This function is used to dynamically make a field required, recommended in JavaScript
Params: field = name of the field
src = url with image eg. /_imgs/frm_required.gif
height = number, optional e.g. 50
width = number optional e.g. 50
Returns: nothing
Example 1 : gSetFieldRequired(, 'new_partweight', 'required'); = add *-sign to label
Example 2: gSetFieldRequired( 'new_partweight', 'recommended'); = add +-sign to label
Example 3: gSetFieldRequired(, 'new_partweight', 'none'); = no image
Calls: nothing
Author: Geron Profet
*/
var attribute = document.getElementById(field);
if (!attribute){return};
switch(src.toLowerCase())
{
case 'required':
src = '/_imgs/frm_required.gif';
attribute.setAttribute('req', 2);
break;
case 'recommended':
src = '/_imgs/frm_recommended.gif';
attribute.setAttribute('req', 1);
break;
case 'none':
src = ''
attribute.setAttribute('req', 0);
break;
}
//if src is passed add image
if (src != '') {
var img = document.createElement("img");
img.setAttribute('src', src);
//check if custom height and width
if (height && height != '' ){img.setAttribute('height', height);}
if (width && width != '' ){img.setAttribute('height', width);}
//img.setAttribute('width', width);
var objLabel = document.getElementById(field+'_c');
if (objLabel){objLabel.appendChild(img)};
}
else{
document.getElementById(field+'_c').innerHTML = document.getElementById(field+'_c').innerText;
}
}
Update MS CRM data via Excel using the Import Wizard
Did you know that you can use the standard Import Wizard in MS CRM to update records in the database?
You can update CRM data by exporting records to Excel, making your desired modifications in Excel, and then re-importing them back into CRM and update the records instead of creating new ones. This can be done in a few easy steps by exporting your data to a dynamic worksheet and doing some minor modifications of the data set before making your changes.
Continue to read the rest of this article…
Notes and considerations:
- Successfully tested today on MS CRM 4.0, update rollup 13.
- Although the product Help file still regards this feature as available, I consider this an unsupported feature. Use the above method at your own risk.
- A record will not be updated if it has been changed in Microsoft Dynamics CRM 4.0 after it was exported.
CRM 2011 Implementation Guide and SDK released
The CRM 2011 Implementation Guide was released a few weeks ago, and it looks like the CRM 2011 SDK has also been released. And the CRM 2011 Developer Training Kit has also been released recently.




