none
How to build an "Everyone Must Approve" approval workflow with Logic Apps? RRS feed

  • Question

  • Hi

    I would like to know how to build an Approval Workflow with Logic Apps that waits for all recipients to "Approve" (or "Reject") before the request can be approved/rejected and the workflow continues. 

    In my workflow I am using the "Send approval email" action to send an approval email to all recipients, but as far as I can see only one recipient is required to "Approve" (or "Reject") the request for the workflow to continue.

    Microsoft Flow has the "Start an approval" action which has an "Approval Type" where the developer can select the "Everyone from the assigned list" option: https://docs.microsoft.com/en-us/flow/all-assigned-must-approve

    Is it possible to configure the Logic Apps "Send approval email" action to approve a request only if everyone approves, and reject the request if a single person rejects it?

    Alternatively, are there any patterns that you can recommended for implementing this type of workflow?

    Thanks
    Andy

    Wednesday, August 14, 2019 9:58 AM

All replies

  • Apparently not. The Send Approval Email only returns the "SelectedOption" user response. The webhook does not return anything else. Microsoft Flow apparently has another API it uses to wait on all the responses before calling back into Flow (Logic Apps).

    Blog | <a href="http://www.sharepointfieldnotes.blogspot.com">SharePoint Field Notes</a> Dev Tools | <a href="http://visualstudiogallery.msdn.microsoft.com/9e03d0f5-f931-4125-a5d1-7c1529554fbd"> SPFastDeploy</a> | <a href="http://bit.ly/1cpgILA">SPRemoteAPIExplorer</a>|<a href="http://bit.ly/29ijZWo">SPRemoteAPI (VSCode)</a>

    Wednesday, August 14, 2019 9:53 PM
  • Thanks for the reply.

    I was able to create the approval process: "Everyone in the recipients list must approve" by 

    1) Creating an array of recipients.

    2) Using a ForEach Connector to iterate through the recipients list.

    3) Send an Approval Email for each recipient.

    4) For each response increment a count variable when the recipient responded with "Approved".

    5) When all recipients had responded the recipients response count is compared to the recipients list count

        a) If the response count == recipients count all recipients have approved. Continue with the workflow (Approved path).

        b) Else request was not approved. Continue with workflow (Rejected path).

    This approach seems to work, but it feels like it could get complicated quite quickly should the approval process be extended e.g. All recipients from list 'A', only 2 recipients from list 'B' and the requester's direct report. Or something similar :-)

    So similar Microsoft Flow, should complex logic be held in an API/Function which can be called by the logic app (e.g. Custom API)? This approach is appealing from a testing viewpoint, but could add significant complexity to the workflow design which would make understanding / maintaining the workflow more difficult.

    Wednesday, September 11, 2019 10:12 AM
  • It sounds like you could create a Durable Azure function to add your own semantics or constraints. I am guessing Flow does this behind the scenes but does not give you much in the way of customizing it. 

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline

    Thursday, September 19, 2019 7:43 PM