Notifications
Announcements
No record found.
Hi all
I need JS code to disable my button. I know workbench disable functionality. I only need js code line which disable my custom button.
Thank You
*This post is locked for comments
Hi Abdul,
why do you need js code for this? You can disable even only one button using Ribbon Workbench.
Regards, Karan
you can write any javascript you want, however keep in mind that the function needs to return true or false. A value of true will result in the Enabling of the button, false will Disable it.
I hope this helps you forward
Bas
HI
Please refer below URL
garethtuckercrm.com/.../dynamically-disable-ribbon-buttons-in-dynamics-crm
Hi Bas van de Sande and Karan5959 and all
I need just a line of code not more than that. Please give it to me.
Hi Alagu nellaikumar.S
Sorry this is not What I need. Please give me a line of code.
Hi,
Please refer this link: https://community.dynamics.com/crm/f/117/t/221915My answer in that post might help you.
Regards,
Please verify if it helps
function disableButton() {
var field = Xrm.Page.getAttribute('fieldName').getValue();
if (field == XY) { return true; }
if (field != XY) { return false; }
}
Hi Ezgi HAGLUND
Hi You code giving me this error
this is my code that works well:
top.document.getElementById("salesorderdetail|NoRelationship|Form|btnRejectDiscount-Medium").style.display = 'none';
and this is the id where I got from F12:
you cannot access the DOM directly, you need to use the Xrm.Page object model.
that's why you get the error.
in you library you can wrte a javascript function like
function foo() {
var field = Xrm.Page.getAttribute('logicalfieldname').getValue();
return (field=='Some Value');
that's all it takes
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 Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2