microsoft-dynamicscrm-ribbon-workbench

Ribbon Workbench display rule-How should a bool value be used?


I am trying to display a button based on a yes/no value. I am using a value rule and have tried 0 and 1, true and false, and InvertResult of nothing.

Does anyone know what the correct value is for assessing a bool? The button should display when the value is true (or not false).

Here is the xml produced and screenshot.

<ValueRule Field="cc_cancloseaswon" Value="Yes" Default="false" InvertResult="false" />

Example


EDIT

The use case is as follows. I have a bool column on the entity to indicate if the button should be visible.

I believe it would set the correct visibility when the value is true. Example

The command checker shows it evaluates as false on top of not being visible. Command checker

Level up shows the value is true: Level up attribute checker

I have refreshed to check it has evaluated when the value is definitely set.


Solution

  • The display rule only evaluates attributes available on the form. true is the correct value for a bool, I just needed to add the attribute to the form.

    I assumed it would assess non-table data but the ribbon seems to use formContext.data.entity attributes. This only occurred to me when I started writing a custom rule and it was an easy idea to test. The attribute can of course be hidden on the form if it doesn't otherwise need to be there.

    If the attribute is not present on the form, it will evaluate as an empty string ''.