Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

ribbon button validation javascript Ribbon Workbench

Posted on by Microsoft Employee

Back in the day (I'm sure few of you remember) one would add validation script to buttons -- if the function returned true the button action continued else it would just stop.

In the ribbon it doesn't appear to have the same functionality.  Looks like I can control button enablement via javascript but, not the firing of the action.  E.g. Opportunity Create Order fires action of CloseAsWon.  Is there a way to check a condition OnClick and have the action either proceed or be interrupted?

All I can see is how to check the condition -- and flash the alert -- on form load while using an enable rule. I.e. onLoad vs onClick.

Am I missing something?

TIA

-md

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: ribbon button validation javascript Ribbon Workbench

    Here is the post that can help you - dynamics365blocks.wordpress.com/.../

    With the handler I meant JS method that is called by the OOB button - so OOB JavaScript function.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: ribbon button validation javascript Ribbon Workbench

    Thanks AB.  Sounds dangerous.  Not sure I know how to call a handler.

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: ribbon button validation javascript Ribbon Workbench

    Hello,

    What you can do here - you can customize the command of the button, copy the handler that is being called and develop own function that do validation and call OOB handler if validation is passed. I did that for Close as Won/Close as Lost for Opportunity.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans