Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Answered

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

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

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,556 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,625 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans