Cancel a Flow from PowerApps?

Copper Contributor

Hello World!

 

I am currently trying to sync an approval Flow with a PowerApps Leave Request demo. I have modified the PowerApp to start a flow when a new request is created (in the OnSelect property just after the request is saved to SharePoint.) If a request is approved/declined via Flow, everything is fine as my app can detect that the status is no longer "Pending" and the "Approve" and "Reject" buttons in the email are gone. This all works fine, but a problem arises when a manager approves/declines in app. If a request is approved/declined in app, the email with the approval still has the "Approve" and "Reject" buttons, meaning they could reject a request that has already been approved.

 

Is there a way that I could cancel a flow from PowerApps (maybe using an id for the flow saved to a column in SharePoint?) so that once a request is approved/declined in either place, all buttons will do nothing?

 

Thanks,

Jordan Holleman

3 Replies

This sounds like conditions in flow. so you will have to check the value of your column/input and use a if statement in flow to correctly follow your flow

I have not fully tested it but a variation on the following flow might work.  It initializes a variable as false, then will set the variable as true once the approval happens.  If you create a parallel branch that has a "do until" the variable is set to true.  That "do until" will check to see if the status has changed from pending and if it has, then it will terminate the flow.  

flow.PNG

I tried this one but it says I cannot put Terminate control in Do until loop