How to Run JS snippet using Smart Button in Ribbon Workbench?
In this blog, we’ll show you how you can call a piece of JavaScript code snippet using a smart button in the Ribbon Workbench. If you haven’t yet installed smart Buttons to your Ribbon Workbench in your organization – For that here's a blog from which you could add buttons – https://www.xrmlabs.com/About-Us/XRMs-Blog/Post/8466/How-to-Install-Smart-Buttons-for-Ribbon-Workbench-XrmToolBox
Quick JS
To run a small code snippet upon clicking the smart ribbon button, follow these steps. –
- Here in the below image, you can see a smart button named Quick JS, which you can use to run a snippet of JS code.

- When you drag a JS Quick button on the Form Ribbon, you'll be asked to provide its name and a JavaScript code to run.

- After you’ve entered this, you can see the button show up. Finally, publish the changes and confirm on the actual record (or Grid based on where you have used this)

Working -
Here you can see how the button will work when using Quick JS Smart Button –
- You can see that the button is now displayed on the Form.
I opened to Console in Dev Tools to show what the JS snippet will do (considering that in this example, it’s supposed to Log a message inside the console).
