0

I want to hide a ribbon button in CRM 2016 using JS. I don't want to use ribbon benchwork. Any help will be appreciated.

sks
  • 1
  • 4

2 Answers2

2

If you don't want to use ribbon workbench you can export ribbon as zip file. Then extract it and manually edit XML file. Here you can find XML reference that will tell you what nodes, attributes and values you should change to achieve required result.

EDIT: to answer your question - there is no supported way to hide a ribbon button from javascript. You could try finding button by ID and changing display attribute but it's UNSUPPORTED.

pen2
  • 759
  • 5
  • 16
  • Thanks for the info pen2 – sks Oct 14 '16 at 09:25
  • If you down this road, you will also need to be careful if your javascript to hide the ribbon is firing on a form.onload event. The ribbon is loaded asynchronously so the element you are trying to hide may not be present yet. – Malachy Feb 15 '17 at 01:30
0

Not sure why you don't want to use the ribbon workbench. It's now included in the XrmToolBox as plugin, so you don't even have to install anything into CRM itself. Using the tool, you just need to locate your button, and add a custom Enable/Disable (not sure which off the top of my head) Rule that uses js. The Ribbon will load the js webresource that you've defined, and your function will just need to return a boolean.

Your other option is to hand edit the solution extract xml... yuck!

Daryl
  • 18,592
  • 9
  • 78
  • 145