Skip to main content

Notifications

Announcements

No record found.

Customer Service forum

Enable and Disable custom button in D365 on a ribbon

Posted on by Microsoft Employee

Good Day,

I have a custom button created on a ribbon, I need to show or hide this button based on a specific value on the field.

I have tried using JScript on the command with a function that does this but it is not working, this hide the entire ribbon.

I have also tried creating display rule and check for a value but this still hides the entire ribbon as well.

Not found any relevant site to do this and each one points exactly what I have done.

Remember the field that I am checking on the form for display of the button is a custom option set field.

I am setting the field properly on the JScript and on the display rule but I still have not found any joy in this.

Why does my display rule, or even my scripts on the command hide the entire  ribbon, what I am doing wrong?

Is there a prescribed way step by step guide I can follow to get this done?

  • Suggested answer
    imayur Profile Picture
    imayur 630 on at
    RE: Enable and Disable custom button in D365 on a ribbon

    Hi,

    You need to use enable rule to hide and display button. you can bind the javascript function which returns true(show) and false(hide) the button.

    1. Create Enable Rule

    2. Add Step > Custom Rule

    3. In Custom rule Set Default Value to false if you want field to be hidden initially

    4. Function Name : Your function name (function has logic to return true/false based on field value)

    5. Library : library is web resource where you function resides.

    then add enable rule in command of your custom button.  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans