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!

Dynamics 365 JavaScript Client Scripting for Beginners | [Video Series]

Hi! If you are a newbie to Dynamics 365 JavaScript, I’ve made a short series on the same from a Beginner’s perspective.

I’ll keep enriching this series with advanced topics soon.

Pre-Requisites

In order to be able to start JavaScript form scripting for Dynamics 365 CRM / Model-Driven Apps, you must have the below –

  1. Beginner to moderate JavaScript knowledge
  2. Visual Studio or Visual Studio Code
  3. System Customizer / System Admin access to the Dynamics 365 / Model-Driven environment.

Also, for complete reference to Dynamics 365 Client Scripting, here’s the official Microsoft Documentation on the same – https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference?WT.mc_id=DX-MVP-5003911

YouTube Videos

Hope this was useful. In order to also look for a beginner series on writing Plugins for Dynamics 365 CRM / Dataverse, I’ve created a Blog Series for the same as well – Plugins Development in Dynamics 365 CRM for Beginners | [Blog Series]


Hope this is a helpful start!
Here are some more Dynamics 365 CE / CRM posts which you might want to check –

  1. Make Managed fields Required in Dynamics 365 – Managed Properties Error [Workaround] | D365 CE Quick Tip
  2. Sign up for a Dynamics 365 Project Operations (Lite Deployment) environment and provision a new instance | Power Platform
  3. Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
  4. Duration field in Dynamics 365 converts Hours value to Days in Dynamics 365 | [Flow Workaround to convert in Hours and Mins]
  5. Show custom ribbon button based on Security Role of the logged in User in Dynamics 365 | Ribbon Workbench in XrmToolbox
  6. Connecting XrmToolBox to an MFA enabled Dynamics 365 environment | Azure AD
  7. Pass Execution Context to JS Script function as a parameter from a Ribbon button in Dynamics 365 | Ribbon Workbench
  8. Pass data to HTML Web Resource using browser’s sessionStorage in Dynamics 365 CE
  9. Form Access Checker in new Power Apps Form Designer | Model-Driven Apps in Dynamics 365
  10. Find deprecated JS code used in your Dynamics 365 environment | Dynamics 365 v9 JS Validator tool | XrmToolBox

Thank you!!