2
votes

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!

2
try with Ribbon Workbench develop1.net/public/page/… I don't remember if is possible to do without a javascript rule, if I have time I will test and write an answerGuido Preite

2 Answers

3
votes

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
votes

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.