Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications

|

Tooltips for Disabled Ribbon Buttons in CRM 2011

Post Author: Joe D365 |

In complex implementations, we often have very lengthy requirements regarding custom ribbon buttons and when they are enabled and when they are disabled. The challenges of implementing such rules has already been covered in this blog post on enabling and disabling ribbon buttons.

The issue we're going to tackle this time is actually bit more interesting. Sometimes users have problems remembering or understanding why certain ribbon buttons in CRM 2011 are disabled. This can cause a lot of support overhead for power users checking the data and explaining the situation.

(DISCLAIMER: The JavaScript below is unsupported and will most likely not survive an upgrade. This post is intended for academic purposes only, so use at your own risk!)

In our example case, we have multi-step rules on ‘Generate Quote’ button, checking existence of items, fields from other entities, fields from current entity, etc.

Out-of-the-box, disabled ribbon buttons in CRM 2011 will only give a generic message: 'This button is currently disabled. You may not have selected the item that works with this feature. If you do not have permissions to use this feature, contact your system administrator.'

The generic message for disabled ribbon buttons in CRM 2011

How can we give more information to the user about WHY the button was disabled? Here are some supported ways:

  • Leave the button enabled and handling validation in button click, then giving user back a message why it failed. However, in my experience, this type of a ‘teaser’ button that looks enabled--but doesn’t work--annoys users.
  • Disable button using JavaScript function. While disabling, we could alert() message user reasons why button was disabled. This would probably annoy users even more.

The best way to handle this from usability standpoint would be to modify the existing tooltip to include information about the reason for disabling the button.

The ToolTipDisabledCommandDescription is actually handled at tab level. Changing that will change the look of all disabled buttons. It can be useful for some cases, but does not really help us in this situation. But here is an example anyway:

Adding JavaScript like this:

[sourcecode language="javascript"]Mscrm.RibbonLayout.tabs['EntityTemplateTab.opportunity.NoRelationship.Form.Mscrm.Form.opportunity.MainTab'].FullLayout.children[0].attrs['ToolTipDisabledCommandDescription'] = 'Click some more and it may work?'
Mscrm.RibbonLayout.tabs['EntityTemplateTab.opportunity.NoRelationship.Form.Mscrm.Form.opportunity.MainTab'].FullLayout.children[0].attrs['ToolTipDisabledCommandTitle'] = 'Yep, it is disabled'[/sourcecode]

Will result to the following message (for EVERY disabled button in this form):

Customized messages for disabled ribbon buttons in CRM 2011! Neato.

So obviously the top part is unique to the button. Maybe best option would be to change that text instead. Below is a simplified function created for this specific button. Note that this example is completely hard-coded for now for a specific group in tab and specific button in group. For actual implementation, the group and button will need to be obtained dynamically.

[sourcecode language="javascript"]setDisabledMessage=function(msg)
{
Mscrm.RibbonLayout.tabs['EntityTemplateTab.opportunity.NoRelationship.Form.Mscrm.Form.opportunity.MainTab'].TabLayout.children[1].children[2].children[0].children[5].attrs['ToolTipDescription'] = msg;
}[/sourcecode]

Now using a pointing to a JavaScript function, we can not only disable the button, but inform user why the button is disabled:

Custom disabled ribbon button message

So there you go. More questions about the customizing the ribbon? Refer to our guide on CRM 2011 ribbon customization.

Happy CRM'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends