Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Hiding a Ribbon Buttons Using Ribbon Workbench to call a JavaScript action

Posted on by 9
I've created a button in Ribbon workbench with a command where when i click on it runs a JS script, first i read a Yes/No value from a table and what i want to do is if this value is /No/ hide the Save and Remove buttons.

 
 
 
_onClickCheckBoolValue: function(executionContext){
        console.log(/Checking bool/);
       
        //Get the value of showdelete
        var showClassID = executionContext.getAttribute(/*****_showdelete/).getValue()
 
        if(showClassID == false){
           //Hide buttons  
        }
       
    },

I want to hide the Save (Guardar) and Delete (Eliminar) buttons on the form in the power apps,
but i cant seem to do it.

Thanks for the help.
  • Hiding a Ribbon Buttons Using Ribbon Workbench to call a JavaScript action
    Hey,
     
     
    Yes i do know that i can add the same Display rule to each button to hide them, but what i wanted to ask is instead of going to each button manually and adding the rule, how could i modify a JS script to do it all at once from there.
     
    Is there a way to do it like that?, with a script.
     
    Thanks for the help.
  • Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Hiding a Ribbon Buttons Using Ribbon Workbench to call a JavaScript action
    Hi Partner,
    Display rules are only created once, after that you can just add them at the command of each button!
    To customise different buttons, you need to add rules to the commands corresponding to the buttons, and the same applies to the enable rules of the js code.
  • Hiding a Ribbon Buttons Using Ribbon Workbench to call a JavaScript action
    Hi,
     
    I've used the value rule for some buttons to hide them, the problem i have with this method is that i have to modify each button one by one by adding the rule, that why i want to use a script to hide N buttons, right now i only want to hide 2 but maybe in the future i'll want to hide 5 or more, so is there any way to modify the script so i can hide all N buttons at once?
     
    Thanks for the help.
  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Hiding a Ribbon Buttons Using Ribbon Workbench to call a JavaScript action
    Hi Partner,
    If you want to hide buttons based on one field value, you can use 'Display rule-ValueRule' to achieve it easily:
    This blog provides two methods, one is 'value rule', the other is 'Javascript', you can refer to the code as well as the steps.
    More details about value rule:
     

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans