cancel
Showing results for 
Search instead for 
Did you mean: 

Tracking your Flow in your SharePoint list

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:

  1. Keep track of the state of the workflow;
  2. Keep track of the outcome of the tasks in the workflow.

What do we need to track

We would like to track the following:

  1. Status of the workflow - this is what state the workflow is in;
  2. Results of tasks - so we need to capture:
    1. Who completed the task;
    2. Date/Time the task was completed;
    3. Outcome of the task (approve, reject etc);
    4. Comments;
    5. Any other fields captured in the card.

Example

Start by creating a new list
NewList.pngSelect "List" from the "New" menu

From our list, we should create a flow
NewFlow.pngSelect "Create a flow" from the Flow menu

Choose the template "When a new item is added in SharePoint, complete a custom action"
customaction.PNGChoose this flow template

We now will add the "Start an Approval" task into our flow:
startapproval.PNGChoose Start an Approval action

Add the details of the approval task:
newapprove.PNGManagers Approval

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:

Choice.pngAdd a column, choose Choice

Call it "Status", and our 2 states are:

  • Managers Approval
  • Completed

statuscolumn.PNGAdd Status field

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:

  • Approver - user who completed the task;
  • Approved Date - Date/time the task was completed;
  • Decision - the decision made;
  • Comment - the comment left by the user.

So let add the 4 fields:

addFields.PNGTask 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:

addupdate.pngAdd Update Item action

Set the Status Value to "Managers Approval", as this is the next item in our workflow that is going to happen:

setmanagerapproval.pngSet the Status to "Managers Approval"

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:

completetask.pngUpdate the list with the results of the Approval Task

Our SharePoint list and workflow are now connected, and we can see the status of the workflow from the list.

wf.PNGCompleted workflow 

Lets test

Now comes the fun part - add an item into our list:

testitem.PNGAdd an item

The Status column should update, showing that the "Manager Approval" task is in action:

in action.PNGStatus column updates

 In our inbox, or flow app, you will receive the task:

task.pngTask from Flow

Complete the task, by approving it, and enter a comment:

taskcomplete.PNGApprove the task, 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:

complete.png

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.

Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Cambridge UK Power Platform User Group Leader, Technical evangelist and speaker. Always says yes to coffee! #LetsGetCoffee
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor
  • I am building business processes and applications that are easy for users' to stick to, so they can follow and understand them. In overall I transform processes to be more reliable and effortless. I am a proud co-organizer of SharePoint Saturday Warsaw and active community member, blogger and international speaker.