问题
I have to hide a ribbon button when the owner of the record isn't the current user.
I'm using Visual Ribbon Editor for CRM 2011 however I didn't find out the solution yet. I tried to use Field rule ValueRule but it just allows me to put a bool value (1 or 0).
Can anyone please tell me how can I do that?
Thank you in advance!
回答1:
Add a Enable Rule like this:
<EnableRules>
<EnableRule Id="YourEntity.Form.XXX.MainTab.XXXXXXXXXX.CustomRule" />
</EnableRules>
Rule Definitions as below:
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules />
<EnableRules>
<EnableRule Id="Email.Form.email.MainTab.XXXXXXXXXX.CustomRule">
<CustomRule FunctionName="DisableButton" Library="$webresource:new_/js/xxx.js" InvertResult="true" />
</EnableRule>
</EnableRules>
</RuleDefinitions>
Write a JavaScript function DisableButton
and to return true or false based on your condition. Reference the js
webresource in CustomRule Library.
回答2:
Value Rules cannot be used with Hide Actions - so you'll need to use a Custom JavaScript Rule with an Enable rule to enable/disable the button rather than hide it.
来源:https://stackoverflow.com/questions/18452521/hide-ribbon-button-crm-2011