How to hide vanilla buttons according to a field?

174 Views Asked by At

Is it possible to hide vanilla buttons (in my case crm save button), according to Javascript function or field change in Dynamics - Crm 2016 using workbench? If it's optional where can I had the connection to my display rule?

2

There are 2 best solutions below

3
On BEST ANSWER

You need to add a ribbon display rule.

Control when ribbon elements are displayed

By defining display rules in rule definitions, you can use the same display rule for many command definitions. When more than one display rule is defined for a command definition, all of the display rules must evaluate as true for the ribbon element to be displayed.

This is easier using Ribbon Workbench. This article is similiar but for enable rules. In later versions of CRM disabling a button usually hides it as well.

0
On
  1. Download the XrmToolbox: https://www.xrmtoolbox.com/
  2. Open the Ribbon Workbench 2016
  3. Open your ribbon
  4. Right-click on the button you want to edit, click Customize command
  5. Go in Solution Elements > Commands > Your command
  6. Add a display rule
  7. Add Step, Value Rule

If you to use javascript for a complex rule, instead add an Enable Rule and a step, CustomRule.