Ribbon button visibility based on a null value in field in Dynamics 365 | Ribbon Workbench

In case you are using ValueRule already for showing / hiding a ribbon button, but wondering how you can check for the same field for null values i.e. showing the ribbon button only when the field contains data?

I’ll explain in this post –

You can also refer this post for showing/hiding button based on a certain value – https://d365demystified.com/2021/01/08/ribbon-button-visibility-based-on-a-field-value-in-dynamics-365-ribbon-workbench/

ValueRule

Let’s consider an example where you want to show a Subscription button based on the Group Code field on the Account form –

  1. I have a Group Code button on the Account Form, if this contains data, only then the Subscription button/flyout button should show.

  2. So, in the Ribbon Workbench, you can select your button and start by adding a Display Rule (Assuming you don’t have other Display Rules already set which you’ll need to take care of)

  3. In the Display Rule, you can select the type as ValueRule

  4. In the value Rule, the field you are checking for in this example is Group Code (Name: cf_groupcode)


    At this point, if I leave the Value as blank in the above screenshot, the button will be hidden if the value is blank in the above shown Display Rule. This acts as Show when “Group Code Does Not Contain Data

    In this case, the button will be shown when the Group Code field is blank.


    And hidden when the Group Code field Contains Data


  5. Now, if we choose to Invert Result, you’ll get this – This will act as Show when “Group Code Contains Data


    Now, in this condition, the Ribbon button will be shown is the Group Code has data in it.


    And will be hidden when the Group Code field is blank.

Also Ensure

If you are wondering if your changes are being applied, also cross check the below two points –

  1. The Command must be attached to the button.

  2. And the DisplayRule must be attached to the Command itself.

Hope this was useful!

Here are some more XrmToolBox related posts which you might want to check –

  1. Create a Flyout menu for ribbons in Ribbon Workbench | XrmToolBox
  2. Show custom ribbon button based on Security Role of the logged in User in Dynamics 365 | Ribbon Workbench in XrmToolbox
  3. Connecting XrmToolBox to an MFA enabled Dynamics 365 environment | Azure AD
  4. Find deprecated JS code used in your Dynamics 365 environment | Dynamics 365 v9 JS Validator tool | XrmToolBox
  5. Delete App Passwords created by other users in Office 365 | Multi-factor authentication
  6. Single record and multiple record auditing in Dynamics 365 to Audit record access | M365 Compliance
  7. Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
  8. Show custom ribbon button based on Security Role of the logged in User in Dynamics 365 | Ribbon Workbench in XrmToolbox
  9. Ribbon button visibility based on a field value in Dynamics 365 | Ribbon Workbench
  10. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  11. Pass Execution Context to JS Script function as a parameter from a Ribbon button in Dynamics 365 | Ribbon Workbench

Thank you!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.