Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to disable more than one ribbon button with one Enable Rule by calling from one button?

Posted on by Microsoft Employee

Hi Experts,

We recently migrated from CRM 2011 to CRM 2016 on-premise. In CRM 2011 we have Custom Enable Rule to disable buttons on entity based on such criteria. We were using this rule on more than 4 buttons. So all the time when form was refreshing, rule hit the database frequently for each button.

So to minimize the number of hits on form load we are thinking to call the Custom Rule for one button only and with in code disable other buttons.

We tried with DOM (Document Object Model) and this is working but not consistent. We found that sometimes buttons were not loaded before the code run.

Please suggest the way to do this. Any other approach with low cost for performance is also welcome.

TIA

*This post is locked for comments

  • Suggested answer
    ScottDurow Profile Picture
    ScottDurow 50,177 on at
    RE: How to disable more than one ribbon button with one Enable Rule by calling from one button?

    Expanding on David’s suggestion. If you create a static variable that your enable rule sets the first time it is run - you can then use that value the next time it is run and return that instead of performing the query.

    Hope this helps

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to disable more than one ribbon button with one Enable Rule by calling from one button?

    Hi David,

    Can you please explain bit with example?

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: How to disable more than one ribbon button with one Enable Rule by calling from one button?

    I'd suggest writing your custom rule code so that it caches the results on the first call, and subsequent calls use the cached results. As most calls are async, you might need to expand on this a bit - e.g. set a flag at the start of the first call

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans