web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Possibility of prevent...
Power Apps
Unanswered

Possibility of prevent save in PostSave functions

(0) ShareShare
ReportReport
Posted on by 48

Dear Community, 

 

I have a challenge when using PostSave event functions: I cannot prevent save when some conditions are met.

As stated on the MS site, when the form OnPostSave event occurs, you can use the getEventArgs method of the execution context object to retrieve an object that contains methods you can use to manage the postsave event and those are: getEntityReference, getIsSaveSuccess and getSaveErrorInfo.

It means that even if we enable Async on Save in power app settings, we won't be able to benefit from executionContext.getEventArgs().preventDefault() and executionContext.getEventArgs().disableAsyncTimeout methods.

Do you have any suggestion how to prevent save on PostSave event functions?
 
Regards,
Milos
I have the same question (0)
  • Parvez Ghumra Profile Picture
    1,579 Moderator on at

    @Milosh I believe the PostSave event occurs just after the record has been saved. To use preventDefault your code needs to run pre-save (ie. By wiring up your event handler function to the onSave event configurable in the form designer)

  • Federico Pelliccia Profile Picture
    143 on at

    As the name says, the onPostSave is an event that occour after the save of a record. What you are looking for is the OnSave event, that occours before che save itself
    Form OnSave event (Client API reference) in model-driven apps - Power Apps | Microsoft Learn\

    In this event you can check for some condition and use the method executionContext.getEventArgs().preventDefault();

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,041

#2
11manish Profile Picture

11manish 676

#3
Valantis Profile Picture

Valantis 655

Last 30 days Overall leaderboard