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 / handling a SubmitForm ...
Power Apps
Answered

handling a SubmitForm failure

(2) ShareShare
ReportReport
Posted on by 77

On a Save form button I have the following OnSelect:

SubmitForm(EphysExpEdit); If (patchLookupEphys = true, Patch('Exp Slice Ephys 2', Last('Exp Slice Ephys 2'), {Animal_rel:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Id:Gallery_Animals.Selected.ID, Value:Gallery_Animals.Selected.Title }} )); UpdateContext({patchLookupEphys: false})

A couple of times recently I've had an issue where the SubmitForm function fails for some unknown reason, and then the rest of the arguments are executed. Of course this causes a problem because the following arguments rely on the SubmitForm function working as they modify the Last() record. (I have to do this annoyingly hacky Patch() stuff because PowerApps doesnt handle linked SharePoint lists well).

 

What would be the best way of handling potential errors from SubmitForm, so the rest of the arguments only are executed if the submission works?

 

Thanks

Categories:
I have the same question (0)
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at
    Put the commands in the "on success" dropdown of the form to be submitted..
  • Verified answer
    nickduxfield Profile Picture
    497 on at

    @Drrickryp, goodone forms are great for some basic built in errorchecking process. Can I add some more information please?

    @sfishe, Click on the form to get all the form controls in the properties panel on the right.

    Play around with your strategy by shifting your code from the button to the 

    OnSuccess (Do this if the form submission succeeds)

    OnFailure (Do this if the form submission fails)

    OnReset (Do that upon form reset function())

     

    If you string it all together on the button, you will get an error because alot of the code is only appropriate after a submission of the form. Especially patch functions with rules like Last().

     

    onsucceess.PNG

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you, I was wondering how to perform an action only on success

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 408

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 319

Last 30 days Overall leaderboard