Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Button Enable rule in Ribbon Workbench Runs thrice

Posted on by 370

Hi all,

I have some script and function specified in the enable rule of a custom button in command bar.

The problem is the function executes thrice. i tried changing the web resource name and function name as well as i suspected the function being called from some where else too  but didn't help.

Can you please help me figure out  why is this happening?

Thanks in advance.

Regards

Prem Prakash

*This post is locked for comments

  • Prem27 Profile Picture
    Prem27 370 on at
    RE: Button Enable rule in Ribbon Workbench Runs thrice

    Hi Inogic,

    I am using a function that i need to trigger to fetch some results on default page load (sales dashboard). Now dashboard doesn't have a form where i can attach a function on it's onload event, so instead i created a command ribbon button for dashboard and in it's enable rule i am using the required function. Now when function executes thrice it retrieves and displays the data thrice,that is my problem.

  • Inogic Profile Picture
    Inogic 24,094 on at
    RE: Button Enable rule in Ribbon Workbench Runs thrice

    Hi Prem Prakash,

     

    There are chances where ribbon button script get trigger multiple times on load of page. But there shouldn’t be a problem with that. Enable rule always return single true or false value. So no matter how many times your scripts triggers your script should return Boolean value i.e. either true or false.

     

    While writing a script for enable rule you must,

    1)      Avoid global variables,

    2)      Write a script that will run synchronously

     

    Hope this helps!

     

    Thanks!

  • Prem27 Profile Picture
    Prem27 370 on at
    RE: Button Enable rule in Ribbon Workbench Runs thrice

    Also i forgot to mention, this happens only the first time when i am loading my organizations default page (sales dashboard). Second time if i reload the same page enable rule runs fine (only once).

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