Skip to main content
Dynamics 365 general forum

Power Platform 2021 Wave 1 – My Favourite Features for Power Apps – Part 4

editSubscribe (0) ShareShare
Posted on by 18,046

Async OnSave events

In a model-driven app form, to do any validations on record save, we use OnSave event of the form. We bind the event handler function by directly adding it in form properties OnSave or by binding the handler function using addOnSave ( When the record is saved (user clicked on Save / Save&Close or auto-save was triggered or save triggered from code using / /…)), the OnSave handler function is called and we have to use the formcontext.geteventargs().preventdefault() block the default save, perform validations and then trigger another save. We also have to handle what happens after saved depending on how the Save was triggered. As you can see adding custom logic to OnSave event to perform any validation is not very straightforward and not a clean approach and performing any async calls makes it even more complicated.

With the release of 2021 Wave1, Async OnSave feature will allow a promise to be passed to perform validations and if the promise does not resolve within 10 seconds, the save will be blocked. This provide a lot more cleaner pipeline to hook into OnSave with a flexibility to perform complex validations. I have tried to do some tests on my trial instances but the feature is still not available on my environment. I will update this post with sample code once I had a chance to play with it.

Public Preview – Feb 1, 2021 | Early Access – N/A | General Availability – April 2021

What are Async OnSave events?

This provides the ability to create Async OnSave events. Async OnSave events will now wait when they provide a promise, and there is also a new timeout if the promise does not resolve within 10 seconds. If it does not resolve within 10 seconds, the save operation will be blocked.

Some useful links related to OnSave event


*This post is locked for comments

  • LuHao Profile Picture
    LuHao 40,832 on at
    RE: Power Platform 2021 Wave 1 – My Favourite Features for Power Apps – Part 4

    Hi Kokulan,

    Thanks for your sharing.

    Please request a community blog to post your blogs.

Helpful resources

Quick Links

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…


Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,080 Super User

Martin Dráb Profile Picture

Martin Dráb 222,601 Super User

nmaenpaa Profile Picture

nmaenpaa 101,138

Featured topics

Product updates

Dynamics 365 release plans