Wednesday, 28 March 2018

Microsoft Flow : Custom response summary with user comments in Approval action

Flow approvals are really great to implement simple business processes. With the "Start an approval" action, we can carry out two kinds of approvals

1) Anyone from the assigned list
2) Everyone from the assigned list.

With the "Everyone from the assigned list", each of the assigned user is sent a request to approve or reject. Consider a scenario where you send a request to 2 users for approval. The first user approves however, the second user rejects the request. In this case, the final response of the approval step is "Rejected".

You might want to know which user approved and which rejected the request along with their feedback. There is a way to do that in Flow, by using the "Response Summary" value that comes with the output of the approval step.

Drawback :

With this value, comments of each user are not captured in the response summary.

Here, we can create our custom response which also includes the comments sent by the individual
user while approving or rejecting the request

If the response is rejected (or approved) based on where you want to configure the response summary

- We loop the "Responses" value and for each response, we form a summary of the individual response using "IndividualApprovalData" compose action.

- Notice that the individual "Comments" are available now

- Response : We have used the "Approver response" value and not the "Response" value. Response value gives the overall response of the action.

- We have used a custom expression to format the date

             formatDateTime(items('Apply_to_each')?['requestDate'],'MM/dd/yyyy hh:mm:ss')
            formatDateTime(items('Apply_to_each')?['responseDate'],'MM/dd/yyyy hh:mm:ss')

- Leave some space at the bottom of each response in the compose action

- The "ResponseSummary" compose action joins all the individual responses using the below expression

Join(outputs('IndividualApprovalData'), '')

The custom summary looks as below

No comments:

Post a Comment