There are some marked differences in the way that the Ribbon is handled between Outlook and the Web Client of Dynamics CRM.
Mandatory DisplayRule and EnableRule
In the Web Client you can create buttons that refer to a command with just an action. If you want to make the button appear in Outlook, you need to have both a display rule and en enable rule.
If you don't add at least one of each, you will not see your button because Outlook is failing to evaluate the rules. To see the reason why buttons are not showing up, you need to turn on Developer Debug messages in Outlook :
(Options->Advanced->Show add-in user interface errors)
Restart outlook and you will get the following error message:
An exception occurred while calling function "HrExplorerServerButtonGetVisible"
To correct this, using the Ribbon Workbench, the minimum you should have is a Display Rule and an Enable Rule both added to your Command. Each rule should have an OrEnableRule that detects either the Web or Outlook Client.
This gives the following Ribbon Xml:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | < CommandDefinitions >
< CommandDefinition Id = "new.ApplicationRibbon.Command0.Command" >
< EnableRules >
< EnableRule Id = "new.ApplicationRibbon.EnableRule0.EnableRule" />
</ EnableRules >
< DisplayRules >
< DisplayRule Id = "new.ApplicationRibbon.DisplayRule0.DisplayRule" />
</ DisplayRules >
< Actions >
< Url Address = "about:blank" WinMode = "0" />
</ Actions >
</ CommandDefinition >
</ CommandDefinitions >
< RuleDefinitions >
< TabDisplayRules />
< DisplayRules >
< DisplayRule Id = "new.ApplicationRibbon.DisplayRule0.DisplayRule" >
< OrRule >
< Or >
< CrmClientTypeRule Type = "Outlook" />
</ Or >
< Or >
< CrmClientTypeRule Type = "Web" />
</ Or >
</ OrRule >
</ DisplayRule >
</ DisplayRules >
< EnableRules >
< EnableRule Id = "new.ApplicationRibbon.EnableRule0.EnableRule" >
< OrRule >
< Or >
< CrmClientTypeRule Type = "Web" />
</ Or >
< Or >
< CrmClientTypeRule Type = "Outlook" />
</ Or >
</ OrRule >
</ EnableRule >
</ EnableRules >
</ RuleDefinitions >
|
Actually it doesn't matter what rules you use, provided there is at least one and it evaluates as true for both Outlook and the Web Client.
Unique ID's
In the Web Client, each Homepage ribbon is loaded on the fly within a browser window. In Outlook, all of these ribbons are loaded on start up. If you don't have unique identifiers for all CustomActions and Buttons, you will receive the error:
Error Found in Custom UI XML of "Microsoft Dynamics CRM"
"The ID CrmOrg.<GUID>.<Button ID>' is duplicated"
This issue was originally described by http://blog.sonomapartners.com/2011/08/ribbon-errors-in-outlook-add-in-for-dynamics-crm-2011.html
The most recent version of the Ribbon Workbench for Dynamics CRM 2011, ensures that when you add a button to a group on a tab that is duplicated for more than one entity (i.e. The Application Ribbon tabs), it add '{!EntityLogicalName}' into the ID, so that no two ID will be the same.
E.g.
1 2 3 4 5 | < CustomAction Id = "new.ApplicationRibbon.{!EntityLogicalName}.Button12.Button.CustomAction" Location = "Mscrm.HomepageGrid.{!EntityLogicalName}.MainTab.Management.Controls._children" Sequence = "45" >
< CommandUIDefinition >
< Button Id = "new.ApplicationRibbon.{!EntityLogicalName}.Button12.Button" LabelText = "$LocLabels:new.ApplicationRibbon.Button12.Button.LabelText" Sequence = "45" TemplateAlias = "o2" />
</ CommandUIDefinition >
</ CustomAction >
|
Thanks to Peter Hörnell for his help with this one.