I'm currently trying to show / hide a custom ribbon button based on the value of a checkbox in a form.
I managed to get my XML to work fine with the <EnableRule>i created , but as soon as I try to use <DisplayRule>this button disappears, no matter what value I put in the field new_is_trading.
Here is my XML below:
<CommandUIDefinition>
<Group Id="Mscrm.Form.account.CustomGroup.Group"
Command="Mscrm.Form.account.CustomGroup.Command"
Title="Client Commands"
Sequence="51"
Template="Mscrm.Templates.Flexible2">
<Controls Id="Mscrm.Form.account.CustomGroup.Controls">
<Button Id="Mscrm.Form.account.CustomGroup.Button.A"
Command="Mscrm.Form.account.CustomGroup.Button.A.Command"
Sequence="10"
LabelText="Custom Button"
ToolTipTitle="Description"
ToolTipDescription="Should only be shown if this account is trading"
TemplateAlias="o1"
Image16by16="/_imgs/ribbon/CustomEntity_16.png"
Image32by32="/_imgs/ribbon/CustomEntity_32.png" />
</Controls>
</Group>
</CommandUIDefinition>
Then in my rule definitions:
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules>
<DisplayRule Id="Mscrm.Form.account.CustomDisplayRules.DisplayIfClient">
<ValueRule Field="new_is_trading" Value="true" />
</DisplayRule>
</DisplayRules>
<EnableRules>
<EnableRule Id="Mscrm.Form.account.CustomEnableRules.EnableIfClient">
<ValueRule Field="new_is_trading" Value="true" />
</EnableRule>
</EnableRules>
</RuleDefinitions>
Again, mine EnableRuleworks fine, but mine DisplayRulefor some reason doesn't work!
source
share