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 / Triggering a flow in O...
Power Apps
Unanswered

Triggering a flow in OnFailure property of a submitted form

(0) ShareShare
ReportReport
Posted on by 101

In my app there is an Edit form which writes to a sharepoint list. There is a flow that handles a number of notifications off the back of a submission, so generally this is triggered in the OnSuccess property and works just fine. I also want the same flow to trigger in the OnFailure properly passing the form.error object as a context variable to the flow.

 

So, much like in the OnSuccess property I have this code in the OnFailure:

 

NameofmyFlow.Run("ERROR",detailsEditForm.LastSubmit.ID,User().FullName,User().Email,detailsEditForm.Error);UpdateContext({showPopup:false}); Notify("There was an error submitting the form. A helpdesk ticket has been raised", NotificationType.Error)

 

When the form errors I see the Notify message and the 'showPopup' variable is changed to close my dialog box but there is no evidence of the flow being triggered in Power Automate. Nor any errors being returned to indicate why. The exact same (except the first context string isn't "ERROR") Flow.run works in OnSuccess

Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @WillJay ,

    Is there some error message with the NameofmyFlow.Run() formula within the OnFailure property of the Edit form?

     

    Based on the issue that you mentioned, I found that the OnFailure property of the Edit form has been fired successfully. Please check if there is an error message with your NameofmyFlow.Run() formula.

     

    According to the formula that you provided, I could not find any syntax error with it. I have also made a test on my side, and do not have the issue that you mentioned, the flow fires well on my side.

     

    Please also consider take a try with the following workaround:

    Set the OnSelect property of the "Submit" button to following:

    If(
     detailsEditForm.Valid,
     SubmitForm(detailsEditForm),
     NameofmyFlow.Run("ERROR",detailsEditForm.LastSubmit.ID,User().FullName,User().Email,detailsEditForm.Error);UpdateContext({showPopup:false}); Notify("There was an error submitting the form. A helpdesk ticket has been raised", NotificationType.Error)
    )

    Note: Please remove the formula from the OnFailure property of the Edit form

    Please take a try with above solution, check if the NameofmyFlow.Run() formula could be fired successfully

     

    In addition, there may have some delay in firing the flow from your canvas app, please wait for 1 minute almost, then refresh the Flow Run History, then check if the flow is exected.

     

    Best regards,

  • WillJay Profile Picture
    101 on at

    Thanks @v-xida-msft ,

     

    I gave that a try, however it is database operation errors I want to catch rather than form validation. As such the formula you've written will attempt to submit the form and fail (I'm deleting the target list record for my test case) which is what I believe OnFailure should pick up. Is that what you have managed to get working with your attempt?

     

    I think you're on the right lines, I can probably do some sort of try....catch error handling on the submit button where I kick off the form submission I suppose....It just seems so strange that the OnSuccess property of the same form successfully triggers the Flow, the OnFailure property does not. I might also try creating a separate Flow just for the error.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @WillJay ,

    Yeah, the flow fires well within the OnFailure property of my Edit form. I agree with your thought almost. You could consider create another separated flow to handle the error event, then execute another flow action within the OnFailure property of Edit form, check if the issue is solved.

     

    In addition, as an alternative solution, you could consider set the OnSelect property of the "Submit" button to following:

    SubmitForm(EditForm1);
    If(
     !IsEmpty(Errors('Your SP List')),
     NameofmyFlow.Run("ERROR",detailsEditForm.LastSubmit.ID,User().FullName,User().Email,detailsEditForm.Error);UpdateContext({showPopup:false}); Notify("There was an error submitting the form. A helpdesk ticket has been raised", NotificationType.Error)
    )

     

    or

    Set the OnSelect property of the "Submit" button to following:

    SubmitForm(EditForm1);

    set the OnFailure property of the Edit form to following:

    If(
     !IsEmpty(Errors('Your SP List')),
     NameofmyFlow.Run("ERROR",detailsEditForm.LastSubmit.ID,User().FullName,User().Email,detailsEditForm.Error);UpdateContext({showPopup:false}); Notify("There was an error submitting the form. A helpdesk ticket has been raised", NotificationType.Error)
    )

     

    Please take a try with above solution, check if the issue is solved.

     

    Best regards,

  • WillJay Profile Picture
    101 on at

    I have to admit I didn't realise that a run error would only be visible in the actual code bar and that certain other actions would clear it. In attempting your solutions (which would probably work!) I learnt this and discovered the issue all along has been that I've been trying to pass an integer to the flow using formname.LastSubmit.ID - however if a submission fails (at least for the failures I've been testing) then .LastSubmit doesn't contain a record. 

     

    I replaced the LastSubmit.ID with a hardcoded integer value and the original code worked!

     

    Thanks for the help 🙂

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard