Hi,
I have hidden a button in the ribbon using a DisplayRule, but I can't seem to find any way to show this button using javascript? I can't get a reference to the control using formContext.
I want to hide the button by default. In the OnLoad event I want to make a request to a third party to decide if the button should be visible.
Is this possible to do?
/Frode
Thanks for the links. I have not tried the approach in the second link. Will try that and let you know how it works.
I remember in CRM 2013 and 2015 version when we add custom rule under Enable rule button used to disabled or enabled. And to hide/show button we used to use display rule. But this has changed now, Enable rule with customRule will actually show/hide buttons based on return value from Javascript.
See below article to confirm my theory.
xrmdynamicscrm.wordpress.com/.../
To get the formcontext from Ribbon javascript, you should pass primary control CRM parameter to function. See this in above articles.
Yes thank you. That is our current solution. With an Enable Rule you can create a CustomRule and reference a webresource file and a function to set the rule. This works great, but I have a customer that want to hide/show the button instead. Unfortunately there is no CustomRule type of functionality for the Display Rules. I am looking for a script based solution to solve this if possible.
/Frodejavascript:void(0);
Hello,
You can use Enable Rule that returns the promise - docs.microsoft.com/.../define-ribbon-enable-rules
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Mansi Soni as our August 2025 Community…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
DAnny3211 134
Daniyal Khaleel 132
Abhilash Warrier 70 Super User 2025 Season 2