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

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard