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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Disable custom ribbon button using java script

(0) ShareShare
ReportReport
Posted on by

Hi

I have created a custom Ribbon button using ribbon work bench and associated a command with it, in which when users clicks it, a js functions being called. But, in this function, based on a condition, I want to disable the custom button on ribbon. Suppose I run a Custom Action, and until I get a response, I want to disable this ribbon button.

How is this possible ? 

Best Regards 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Bas van de Sande Profile Picture
    4,383 on at

    Hi Babak,

    In the ribbon workbench you can apply display/enable rules to the custom button. In the rule you have to add a "custom rule". In the custom rule you can refer to a javascript library and function.

    I hope this helps you forward

    Bas

  • Community Member Profile Picture
    on at

    Hi Bas van de Sand

    The display/enable rules does not solve my problem, cause I already bind a custom action for that button, and I want to disable the button inside the custom action.

  • Suggested answer
    Alagunellaikumar Profile Picture
    6,212 on at

    HI

    Please refer below URL

    garethtuckercrm.com/.../dynamically-disable-ribbon-buttons-in-dynamics-crm

  • Verified answer
    Community Member Profile Picture
    on at

    Hi Babak,

    If you want to disable your button based on spesific condition you can use display rule and enable rule on ribbon workbench.

    Please refer this link for it: ribbonworkbench.uservoice.com/.../121427-enable-disable-a-ribbon-button-dynamically-based-o

    If you want to hide your button with JS here is the code

    top.document.getElementById("command").style.display = 'none';

    To be able use it you need to hit F12 first and get your ribbon's command and paste it "command"  part.

    1222.Ekran-Al_3101_nt_3101_s_3101_.PNG

    Hope I got your problem right and my answer is helpful.

    Regards,

  • Community Member Profile Picture
    on at

    Hi Ezgi HAGLUND

    Thanks for your reply,

    What does "top" means in the code snippet you provide ?

    ٍEdited

    I used console.log( top.document.getElementById("salesorder|NoRelationship|Form|Command1.Command"));

    it returns null.

    As I read the attributes of the ribbon button, the span you mentioned in the picture, does not contains id attribute. 

    So I did some Search and saw I can read attribute using querySelector as mention here

    Thanks a lot

  • Community Member Profile Picture
    on at

    Hi Babak,

    I have a very much similar requirement, in which I have to add one Custom button and need to call Custom action on click of that button.

    In order to prevent user to hit the button multiple time, We want to keep it disabled until Action complete its execution in the background and return the response.

    Once response is received I need to enable the button back.

    Please let me know the best way to achieve this requirement.

  • PVenkat Profile Picture
    5 on at

    Hi Amit,

    I have a similar requirement as yours. Need to hide a custom button on a custom action to prevent user from clicking multiple times. So hide it when the user clicks and show it after the JS code execution is complete. Were you able to achieve your requirement. If so, please reply back and let me know how you solved the issue. Thanks!

  • Prutuja Profile Picture
    5 on at

    Based on the TIOBE Index for June 2016 Java is now more well-known than a variety of widely-used programming languages, including C++, Python, C#, PHP and JavaScript. The statistics on usage posted on various websites illustrate the immense popularity and importance of Java in the present day world. Java is an all-purpose programming language. Certain developers prefer to use Java to build desktop GUI applications as well as other developers create numerous web-based applications using Java technologies. In addition, Java is also used extensively for the development of mobile applications and games for Android which is the mobile platform with the biggest user base. There are plenty of reasons that Java is going to be a major factor over an extended period of time.

    Visit: Java Course in Pune

  • Mahima Mantri Profile Picture
    20 on at

    Great post. Thanks for sharing. Sevenmentor offers the best Java course in Pune from industry experts to develop conceptual knowledge of coding with placement assistance.

    Java Course in Pune

  • Suggested answer
    namratha Profile Picture
    5 on at

    nice post. thanks for sharing.info....

    [url=https://gotechmantra.com/tamilrockers-proxy/]tamilrockers[/url]

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans