Search code examples
dynamics-crm-2011ribbon

CRM 2011 Ribbon DisplayRule ValueRule not working


I am currently trying to show/hide a custom ribbon button based on the value of a checkbox on the form.

I have managed to get my XML working fine with the <EnableRule> i created but once i try using a <DisplayRule>, the button in question disappears regardless of whatever value i put into the new_is_trading field.

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, my EnableRule works fine but my DisplayRule does not for some reason!


Solution

  • Use 1(true) and 0(false) to compare Boolean values - this will work. I've the same problem.