Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

How to hide/show a ribbon button in application ribbon using either JavaScript or Ribbon Workbench?

(1) ShareShare
ReportReport
Posted on by 6
I have tried both the approaches:
Through Ribbon workbench, applied display rules as well as enable rule when status is available, button should be visible else not.
In JavaScript, on click of another button, the available button should be visible otherwise , for that I added this line:
parent.document.querySelector('[data-id=/hoabl.ApplicationRibbon.Button11.Button/]').style.display = /none/;
this works fine when testing in console but not in code. 
Any Suggestions?
  • How to hide/show a ribbon button in application ribbon using either JavaScript or Ribbon Workbench?
    Try This.
     
    1 Create Web resource 
                       
      function HideButton(Pc){
            //alert("in");
           var mobilePhone = Pc.getAttribute("cr1d9_phone").getValue();
          if(mobilePhone!=null){
                return true;
          }else{
            return false;
          }
       }
     
    2 Create Enable Rule.
     
     
    3 Use This Rule in your Command.
     

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans