简体   繁体   English

如何使用Javascript在CRM 2016中隐藏功能区按钮

[英]How do I hide a ribbon button in CRM 2016 using Javascript

I want to hide a ribbon button in CRM 2016 using JS. 我想使用JS在CRM 2016中隐藏功能区按钮。 I don't want to use ribbon benchwork. 我不想使用功能区工作。 Any help will be appreciated. 任何帮助将不胜感激。

If you don't want to use ribbon workbench you can export ribbon as zip file. 如果您不想使用功能区工作台,则可以将功能区导出为zip文件。 Then extract it and manually edit XML file. 然后将其解压缩并手动编辑XML文件。 Here you can find XML reference that will tell you what nodes, attributes and values you should change to achieve required result. 在这里,您可以找到XML参考,该参考将告诉您应该更改哪些节点,属性和值以实现所需的结果。

EDIT: to answer your question - there is no supported way to hide a ribbon button from javascript. 编辑:回答您的问题-没有从javascript隐藏功能区按钮的受支持方法。 You could try finding button by ID and changing display attribute but it's UNSUPPORTED. 您可以尝试按ID查找按钮并更改显示属性,但这是不受支持的。

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. 现在,它已作为插件包含在XrmToolBox中,因此您甚至不必在CRM本身中安装任何内容。 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. 使用该工具,您只需要找到按钮,并添加一个使用js的自定义“启用/禁用”(不确定哪一项就可以了)。 The Ribbon will load the js webresource that you've defined, and your function will just need to return a boolean. 功能区将加载您已定义的js网络资源,而您的函数仅需要返回一个布尔值。

Your other option is to hand edit the solution extract xml... yuck! 您的另一个选择是手动编辑解决方案提取xml ...糟糕!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM