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

Community site session details

Session Id :
Dynamics 365 Community / Blogs / DynamicsDevPro / {Know-how} Add a ribbon but...

{Know-how} Add a ribbon button using Ribbon WorkBench

ram r Profile Picture ram r
Hello,

Though its an age old topic, would like to write down step-by-step approach to add an ribbon button for reference.

Prerequisite:
CRM instance with ribbon workbench solution  or Xrmtoolbox



Scenario:
Add a ribbon button on account and on click of the ribbon button show the URL of the record.

Steps:
  1. Open ribbon workbench
  2. Select the solution that contains account entity. 
  3. Add a new js command. Using command we can define JavaScript function or an URL action called on click of ribbon button.
  4. Lets add a Javascript action and call our Alert function which is available in existing Js webresource
  5. Now add the ribbon button and fill in the necessary details. Also link the command to the button and publish the changes
  6. Once done navigate to account and click the button to view the alert
Code snippet to alert URL:
 function alertURL() {  
var url= "{0}/main.aspx?etn={1}&id={2}&pagetype=entityrecord"
Xrm.Utility.alertDialog( url.replace("{0}",Xrm.Page.context.getClientUrl()).replace("{1}", Xrm.Page.data.entity.getEntityName()).replace("{2}", encodeURIComponent(Xrm.Page.data.entity.getId())));
}


HTH! Please leave your feedback on comments section!

This was originally posted here.

Comments

*This post is locked for comments