Very often we will trigger a flow from a SharePoint list, and we need to keep track of where the flow is for the particular list item.
This article is going to explain how to keep track of your flows, from inside your SharePoint list.
To illustrate this, we going to create a small example - we will create a list, and from the list we will trigger a flow.
In the flow, we will send an approval task to a user to approve. This way we demonstrate the following:
What do we need to track
We would like to track the following:
Example
Start by creating a new list
From our list, we should create a flow
Choose the template "When a new item is added in SharePoint, complete a custom action"
We now will add the "Start an Approval" task into our flow:
Add the details of the approval task:
Save this workflow - now we have created our list, and created a workflow that triggers an approval action.
But our list is not connected to our flow at all, so how do we do this?
Extending the List
We have to add a set of fields to our list, to keep track of what is happening in our flow.
Add a Status Column
First we add a new column, a Status field to our list. So start by adding a Choice field to the list:
Call it "Status", and our 2 states are:
This will hold the current state of the workflow.
Keep track of the task
To keep track of the task, we should add the following fields:
So let add the 4 fields:
Now we have all the fields to keep track of the status of the workflow, and the result of task.
Lets wire up the workflow
The only item left to do, is to get our flow to update our list. So let return to our flow, and add the an "SharePoint -Update item" action after the trigger:
Set the Status Value to "Managers Approval", as this is the next item in our workflow that is going to happen:
Now we will record the details of the approval task in the list, so add another "SharePoint - Update item" action after the approval task.
Then set the Status to "Completed", and the Approver Claims, Approved Date, Decision, and Comments from the properties of the "Manager Approval" action:
Our SharePoint list and workflow are now connected, and we can see the status of the workflow from the list.
Lets test
Now comes the fun part - add an item into our list:
The Status column should update, showing that the "Manager Approval" task is in action:
In our inbox, or flow app, you will receive the task:
Complete the task, by approving it, and enter a comment:
Check your list, and you will see the Status is "Completed", and the approver, date, decision and comment is updated in the list:
A good hint is to add view to list for the different status, so it is easy to keep track of where the workflow are for all list items.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.