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.
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.’
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.
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:
Mscrm.RibbonLayout.tabs[‘EntityTemplateTab.opportunity.NoRelationship.Form.Mscrm.Form.opportunity.MainTab’].FullLayout.children.attrs[‘ToolTipDisabledCommandTitle’] = ‘Yep, it is disabled'[/sourcecode]
Will result to the following message (for EVERY disabled button in this form):
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.
Mscrm.RibbonLayout.tabs[‘EntityTemplateTab.opportunity.NoRelationship.Form.Mscrm.Form.opportunity.MainTab’].TabLayout.children.children.children.children.attrs[‘ToolTipDescription’] = msg;
So there you go. More questions about the customizing the ribbon? Refer to our guide on CRM 2011 ribbon customization.