web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to hide itself when clicking a ribbon button

(0) ShareShare
ReportReport
Posted on by 455

Hi,

I wonder if there is any way to hide this button itself when a button is clicked.

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    That could be done. Here is what you should do:

    Use following code and add it to the js webresource:

    var HideButton = (function(){
    	var _isVisible = true;
    
    	function isVisible(){
    		return _isVisible;
    	}
    
    	function onButtonClick(formContext){
    		_isVisible = false;
    		formContext.ui.refreshRibbon();
    	}
    
    	return {
    		IsVisible: isVisible,
    		OnButtonClick: onButtonClick
    	};
    })();

    Add the button, add command, add enable rule of custom type and point it to HideButton.IsVisible from JS Webresource.

    Add Action to the button and use HideButton.OnButtonClick function as a onclick handler passing PrimaryControl as a parameter.

  • Stone Huang Profile Picture
    455 on at

          

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    If my reply answered your question take a minute and click "Yes" under question "Did this answer your question?" at the top of my reply.

  • Stone Huang Profile Picture
    455 on at

    Hi Andrew,

    Your answer solved my question perfectly. Thank you so much.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 151

#2
ManoVerse Profile Picture

ManoVerse 149 Super User 2026 Season 1

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 66 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans