Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Ribbon Workbench: Display rule works, Enable rule doesn't

(0) ShareShare
ReportReport
Posted on by 2

I want to show/hide a ribbon button based on the value of a tickbox on the form.  Using the Ribbon Workbench, I've used a Display Value Rule and it works perfectly.  When I replicate the logic exactly using an Enable Value Rule it doesn't work.  I've double-checked that the Rules are linked to the button via Commands correctly.

Any ideas why this might be?

(BTW, the reason I can't just stick with the Display Rule is because this is a test for what I actually want to do, which is call a custom JavaScript function, which you can't do with Display Rules).

*This post is locked for comments

  • ScheumanRJ Profile Picture
    ScheumanRJ 76 on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    In case it help someone else that finds this thread....

  • Loz Profile Picture
    Loz 2 on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    Removing the Display rule seemed to do the trick, the Enable Rule started working.  So it seems like having both rules in place in the Ribbon Workbench - even if you're just calling one of them with a Command - causes problems.  Thanks Aric, and also Erik who suggested trying the same thing.

  • Verified answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    Try remove the display rule from your code.

    Also, just for test purpose, remove the values from the Default and InvertResult.

    Keep it only with Value Rule and the javascript library/function and see what results you are getting.

  • Loz Profile Picture
    Loz 2 on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    My code was even simpler still:

    return false;

    Then I just manually changed it to test, still didn't work.  I don't think it's a code issue though, that's why I've boiled it down to this Value Rule test.  Seems like Enable Rules just aren't working for me for some reason.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    Hi Loz,

    Can you please validate with below article what you did.

    garethtuckercrm.com/.../dynamically-disable-ribbon-buttons-in-dynamics-crm

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    Hi Loz,

    Can you please validate with below article what you did.

    https://garethtuckercrm.com/2013/11/25/dynamically-disable-ribbon-buttons-in-dynamics-crm/

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    I've never had a problem using a custom javascript on enable rule (solely) to show/hide a ribbon button.

    Was the code very intricate?

    I usually do something like:

    var returnvalue = false;

    if (something something)

    returnvalue = true;

    return returnvalue;

    or some such.

    I don't know why Display rule would work while Enable rule wouldn't, sorry.

  • Loz Profile Picture
    Loz 2 on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    Yes, this is where I started, calling a javascript function from an Enable Rule.  It didn't work, so I gradually worked backwards with simpler and simpler tests.  This was the simplest test I could come up with, just using an identical Value Rule.  Works perfectly as a Display Rule, doesn't work at all as an Enable Rule.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    I believe EnableRule shows/hides just as well as Display Rule. Have you tried using just Enable Rule?

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Ribbon Workbench: Display rule works, Enable rule doesn't

    Hello Loz,

    Can you please check this article , hope you will get help from here.

    garethtuckercrm.com/.../dynamically-disable-ribbon-buttons-in-dynamics-crm

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans