Complete Microsoft Flow approvals using view formatting

In this blog post we will see a way of completing flow approvals (associated with SharePoint list items) from a list view using view formatting.

Completing approvals using view formatting

As we all know Microsoft Flow is a brilliant service offered by Microsoft that helps organisations automate lot of processes. More about Flow can be found here and in several other blogs.

Flow has several helpful actions which make a lot of tasks easier. One such action is “Approval” which starts an approval by assigning a task to the users (approvers). The approvers then take a decision of whether to approve or reject (or any other defined action) and complete the approval. This approval can be used in several processes e.g. leave request, document approval etc.

For approvers, there are a few different options available for taking a decision on the approval. They can do it either by using the buttons in the adaptive cards that are sent in the email to the approvers or by using the links in the email itself or by navigating to the approvals page of the tenant.

Options to complete approval

In this blog post we will look at another way of completing the approval. This will be from a SharePoint list view. Let’s say we had approval associated with items in a SharePoint list, wouldn’t it be nice if we had the decision buttons (approve and reject) visible as part of the list item itself?

For example, if a finance approver has to approve/reject several expenses at the end of the month by looking at the details of the expenses or if a manager needs to approve/reject inventory orders with all the details of the order handy, then it would be good to see the approval action buttons as part of the view.

With view formatting this can be easily achieved. If you haven’t had a chance to play with view formatting please take a look at this article from Microsoft and at these samples from the community members.

Let’s assume that we have already created a list in SharePoint and when items are added to that list, a flow triggers which sends an approval. In this post that list is called “Leave requests” and we will be adding approve and reject buttons in the “All Items” view.

In order to add the decision buttons, we will need to create a couple of anchor tags (one for approve and the other for reject). These anchor tags will take the approver to the approve/reject page after which flow will handle the responsibility of the approval. The links (href) of the anchor tag will be of the following format:

<Flow environment URL>/approvals/received/<Id of the approval>?response=<decision>

Flow environment URL can be easily obtained. Navigate to “” and click on “Approvals” and copy the URL.

The last part of the URL, which is decision, will either be “Approve” or “Reject” based on the button.

To obtain the Id of the approval we need to make some minor updates to the list with which the flow is associated.

  1. Add a column named “ApprovalId” of type single line of text to the underlying list. This will hold the required approval id.
  2. Open the associated flow which has approval action.
  3. If the approval action is of the type “Start and Wait”, please remove that action and add “Create an approval” action instead.
  4. After that add an action to update the list item. We will need to update the “ApprovalId” column of the list item with the id of the approval that was created in the previous step.
  5. We can use either the “Update item” action or the “Send an HTTP request to SharePoint” action to achieve this.
  6. In the ApprovalId column of the action, add the “Approval Id” data from the “Create an approval” action as shown in the screenshot below.
  7. After that add the “Wait for approval” action and again add the “Approval Id” data from the “Create an approval” action as shown in the screenshot below.
  8. So with this we are ready to build the required link for the “Approve” and “Reject” buttons.
The required actions in the flow
The Approval Id that needs to be chosen in Update list item action
The Approval Id that needs to be chosen in Wait for an approval action

Now that we have the missing parts in the link, let’s use that in the view formatting. In the JSON below, we are creating anchor tags with some CSS so that they look like buttons.

Notice the way href of the links (on lines 16 and 38) being constructed. Make sure the flow environment URL is changed as per your environment. Also notice that we are appending the “ApprovalId” column using [$ApprovalId] — which represents the data in the ApprovalId column we created earlier. We also set decision (?response=approve or ?response=reject) based on the link.

Add the above JSON or a similar one to the list view where it is needed. If you are not comfortable with view formatting please take a look at the following links which will help you master view formatting.

Community samples

View formatting videos by Chris Kent

The complete list schema used in the screenshots, with the view formatting can be found here. The columns used are mainly single line of text however as this is a demo list, these can be changed to required types as needed. The view formatting is adapted from the resource catalog sample.

Once the JSON is added, clicking on the decision buttons takes the approver to the approve/reject page and then they can add comments and confirm their decision. After this flow will continue with the next steps after approval. In this way, several approvals can completed by the approvers by looking at the corresponding list item details.

SharePoint developer at Content+Cloud.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store