Asked by:
how to disable custom button through javascript in crm 2013

Question
-
Hi,
I have created a custom button I want to hide button on condition I have tried Workbench but button still visible.
Tuesday, January 13, 2015 7:21 AM
All replies
-
Hello,
Could you please provide screenshots of Show/Enable rules for your button and command that is attached to your button? I'm pretty sure that Ribbon Workbench works fine.
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blogTuesday, January 13, 2015 7:27 AMModerator -
Hi,
in RibbonWorkbench you can customize all actions and visibilities using javascript.
In Solution Elements:
In "Enable Rules" add new rule. In that rule. In the rule, add Step. In the step you can choice "Function name" in your JS code, that return true or false, depending of your condition.
Then in "Commands" chose your command. In command under "Actions" there is "EnableRules". Add your rule there.
Unfortunately, i can't place screenshot here. It will be more clearly to understand, where those buttons appear.
Tuesday, January 13, 2015 8:53 AM -
This is my display rule for button.
Tuesday, January 13, 2015 9:12 AM -
Try to do it in "Enable Rules" not in "Display Rules"
- Edited by xjomanx Tuesday, January 13, 2015 9:24 AM
Tuesday, January 13, 2015 9:23 AM -
I rechecked Rule you've used and it seems that it is for internal use only - http://msdn.microsoft.com/en-us/library/dn481584.aspx
I would suggest to use ValueRule or JavaScriptRule instead.
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blogTuesday, January 13, 2015 9:27 AMModerator