I added a new custom button to quote form ribbon. This button should only appear, if the statecode is active (Value: 1).
I created following CommandDefinition:
<CommandDefinition Id="mySolution.quote.Form.MyButton.Command">
<EnableRules />
<DisplayRules>
<DisplayRule Id="mySolution.QuoteIsActive" />
</DisplayRules>
<Actions>
<JavaScriptFunction FunctionName="myFunction" Library="$webresource:new_myLibrary" />
</Actions>
</CommandDefinition>
And following DisplayRule:
<DisplayRule Id="mySolution.QuoteIsActive">
<ValueRule Field="statecode" Value="1" Default="true" />
</DisplayRule>
But if I use this DisplayRule my button never appears. If I remove the rule from CommandDefinition the button is always visible.
I also tried to use 'Active' as value (as shown at the bottom of this post, with the same result.
What is the trick to define a rule depending on statecode? Or did I miss something?
Try using Status text values ("Open", "Draft", "Active", ect.) instead of number values. I have a similar case with Status Reasons. Hope it will help!
I couldn't find anything to verify this, but display rules seem to have issues in the command bar. I had better luck using enable rules, and those actually act like you would expect display rules to act in the command bar. In other words, if a button in the command bar is disabled then it's not displayed. You can read about it in the MSDN documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With