Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Possibility of prevent save in PostSave functions

(0) ShareShare
ReportReport
Posted on by 46

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
  • Federico Pelliccia Profile Picture
    142 on at
    Re: Possibility of prevent save in PostSave functions

    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();

  • Parvez Ghumra Profile Picture
    1,579 Super User 2025 Season 1 on at
    Re: Possibility of prevent save in PostSave functions

    @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)

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 76 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

Overall leaderboard