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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to Get Ribbon Button ID and Command Using JavaScript

(0) ShareShare
ReportReport
Posted on by 5

Hello All Of You,

I hope you all is well.

I am trying to getting Out of the Box Ribbon Button or Custom Button Command or Button ID using JavaScript in which i have passed the CRM Parameters primaryControl and Call Function in Ribbon Button Command.

This is my code:

function getRibbonCommandOrID(primaryControl) {

    debugger;
    var formContext = primaryControl;
    
 }

Pleas give me the solution.

I have the same question (0)
  • Suggested answer
    Nya Profile Picture
    29,060 on at

    Hi,

    Do you have to achieve it with JavaScript?

    The id and command can be gotten easily with Ribbon Workbench.

  • VijayDantani Profile Picture
    5 on at

    Thank you so much Nya.

    Yes , I have to achieve the Ribbon Button Command and Button ID using JavaScript.

    Please give me the solution.

    Many Thanks....

    Thanks & Regards,

    Vijay Dantani

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Why do you need ButtonID Or Command?

    What is it that you are trying to achieve?

    There is no Client API avaiable which  will give you these details, if you can provide the details of the requirement then we should be able to guide you.

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • VijayDantani Profile Picture
    5 on at

    ok , I will developed one JavaScript function in which  i have getting the getting ribbon Button id from JavaScript code and used in code at run time.

  • Mohsin Ali Profile Picture
    3,634 on at

    Please can you mention business requirements that why you need to get button id or button command ?

  • VijayDantani Profile Picture
    5 on at

    For hide/show Ribbon Button based on security role because of i will not write JavaScript code for any particular ribbon button.

    I will used only one JavaScript function and pass as a CRM parameters to run JavaScript code for particular ribbon button.

  • Mohsin Ali Profile Picture
    3,634 on at

    You can do so.

    Only way is to add enable rules for that particular button using Ribbon workbench.

  • Suggested answer
    Nya Profile Picture
    29,060 on at

    Hi,

    Here is a tutorial which you can refer to:

    Hide Custom Ribbon Button [Easy Way] – Ribbon Workbench | D365 Demystified

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 171 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 83

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans