Cancel approvals patttern

There are quite a few posts about approvals in Microsoft Flow. Have you ever noticed that when you have one of your flows sending an approval that there is no option to cancel the approval step?

No cancel option

In this post I’m describing one approach fro cancelling the approval steps so that you can resubmit the approval step.

Also, so far there isn’t an cancel approval step available yet in Flow. Hopefully it will arrive soon. So that I can avoid this pattern.

The Pattern

I’m going to start with the general pattern of the approval step and the cancellation of the same approval.

In my case the approval is initiated from a PowerApp. With the Create an approval I’m creating an approval.

This will create an entry within my common data services that presents the approval step to the user that needs to approve the action.

Then within my left branch I’m going to sit and wait for a response.

Cancel your pending approvals in Microsoft Flow Microsoft Flow, Microsoft Power Apps approvelcancellationpattern

In the right branch I’m checking the current details of my approval task.

Get approval details

Once I get the details I set a variable to collect the current approval status. While waiting for a user to respond this will be set to Pending.

A Do until in the right branch will no check on a regular basis the status of my request again and again.

Cancel your pending approvals in Microsoft Flow Microsoft Flow, Microsoft Power Apps dountilcancelled or approved

Now finally if the request was cancelled I need to terminate the flow that is running.

Cancel your pending approvals in Microsoft Flow Microsoft Flow, Microsoft Power Apps canceled

The terminate step in the above screenshot I’ve set to complete successfully. That way my flows will not fail.

Also note that the approval status is spelled Canceled rather than Cancelled.

Cancelling the request

To update the approval request in my Common Data Services, I’m creating a flow that takes an approval Id and then updated the Record in my CDS and marks it as cancelled.

In my case I’m using a flow to do this using the approval id from the request.

Cancel your pending approvals in Microsoft Flow Microsoft Flow, Microsoft Power Apps cancelmyapproval 2

Please note that this approach may not be 100% supported as data in the CDS is directly updated

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using

25 thoughts on “Cancel your pending approvals in Microsoft Flow”
  1. Did you tested your “CANCELLING THE REQUEST” example?
    It does not work for me. the error:
    “192350006 is not a valid status code for state code msdyn_flow_approvalState.Active on msdyn_flow_approval with Id …”
    Any idea?

  2. Thanks for the quick answer.
    Numbers look OK:

    “_statecode_label”: “Inactive”,
    “msdyn_flow_approval_allowcancel”: false,
    “statuscode”: 192350006,
    “_statuscode_label”: “Canceled”,

    Could you PLS check if your example works and if so, please make a copy of your “Update a record” action. (Copy to clipboard (Preview))

  3. Hi Pieter,

    after spending some time It has worked also for me: I had to additionally update the following fields: “Completed On”, “Status value”: “Inactive” (!important), “Owner Type”: “systemuser”.

    Many thanks and cheers,

  4. Hi, i tried this solution but it didn’t work for me. Appers an error that says: “Principal user is missing prvWritemsdyn_flow_approval privilege”, i assume i have to give permission to the approvals entity… do you know where i have to give this permission?

    sorry for my english.

  5. Thanks for sharing. The issue I see with this stuff is it delays how quickly your approval reacts. With the do until limits for 5000 runs and 30 days, you can only check around every 10 minutes. So it’ll mean you could be waiting around for the flow to re check the attribute before the rest run, I want it instantaneous !

  6. Hi,
    Thanks for sharing the detail i am passing the ID and tried to update CDS record for that id but on the update statement i am getting 400 error.

  7. Please do! Some of the properties has changed. Not sure if this is still valid. If you can, please specify the values required for each property in the “Update a record” action.

  8. is there a way to get the response directly from the approval itself in flow, rather than getting into records?

  9. this means adding actions upon cancellation (update file property or delete) cannot be done without the steps in the article?

    1. Hi Anas,

      That is easily done. Just collect the results given to you by the approval action in your flow. They will have status details in them, including details on cancellations.

  10. Is there a way to cancel just one individual approval out of many multiple approvers that is expecting all users to respond? I am in need of something like this if a person is out. Thanks!

  11. How will this work? I am trying to think how to create this Approval status driven model. I can do a loop to do a “Create an approval” action for each user and do a “Wait for an Approval” out of the loop but I would need to assign an Approval ID. That won’t work properly bc Flow will continue on that assigned Approval ID when he approves. Also, when one person rejects, it won’t move on correctly. Too many moving parts.

  12. This will work even if you leave the Status reason out. But I made a more complete example that works fine.

    Row ID: ApprovalID
    Approval Stage Key: ApprovalID_COMPLETE [I don’t think this is necessary]
    Stage: Complete
    Status Reason: Canceled
    Completed On: utcNow()
    Result: Cancel
    Status: Inactive

    With newer versions of CDS (DataVerse) the option sets seem to fill in correctly.

    My issue is that I have a “Wait for Approval” in a separate flow and although the approval is getting cancelled correctly, “Wait for Approval” is not notified and keeps waiting.

    Any ideas on this?

    (And also can anyone poke MS. This is sorely needed and not nice to do this in an unsupported way)

  13. The way I found to get rid of the “192350006 is not a valid status code for state code was together with the status reason, I’m updating the status to “Inactive”

    You need to show the advanced options for it

  14. Too bad it’s using premium connectors. Just gonna ask my users to gently ignore the notification after the timeout. Quite dirty but whatever

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.