Add a Progress Bar to a Tasks List
A SharePoint Workflows tutorial by Peter Kalmström
A
workflow can give a graphical representation of information
that is frequently changed. You can for example let a flow
update a progress bar in a Tasks list each time the "% Complete"
value is changed.
In the demo below, Peter Kalmström, CEO and Systems Designer
of kalmstrom.com Business Solutions, shows how to create
such a workflow for progress bar additions and updates.
You can of course build other graphics in a similar way,
for example for conditional formatting.
Peter
uses a list that build on the Tasks template, but he changes
the content type into a type that has a "Progress" site
column.
If you want to create the workflow for just one list, you
can keep the default content type and just add a list column
for the progress bar instead. It must be a multiple lines
of text column with Enhanced rich text enabled.
The "Progress" column should of course be visible in the
default view, but it can very well be hidden from the form.
Hide the "Progress" column from the form
Users don't need the Progress column when they fill out
the item forms, so it is suitable to hide it there.
- Allow management of content types under List settings
Advanced settings.
- Open the content type you use for the list.
- Open the column you want to hide and select the
option 'Hidden'.
The progress bar HTML code
The HTML code used for the progress bars in the image above
is:
<table style="width: 100px; border: 0px">
<tr>
<td style="padding: 0px; width: 100px; background-color: green"></td>
<td style="padding: 0px; min-height: 16px; background-color: red"></td>
</tr>
</table>
NOTE:100 is marked bold above, because in the flow it will
be replaced by dynamic content that calculates the required
width.
Steps to create a workflow that adds and updates progress
bars
Peter creates a SharePoint 2013 list workflow, but you can
also select to create a 2010 workflow or a reusable workflow
for the progress bar.
- Create a SharePoint 2013 list workflow that starts
when an item is created or changed. Go to the end of
the workflow.
- Create a Local Variable called Percent. The Type
should be Number.
- Add the action Do Calculation to give the variable
a value: the % Completed field multiplied by 100. The
output should be the Percent variable that you created
in step 2.
- Add an Update List Item action for the Progress
column. Open the String Builder and paste the HTML code.
Replace100 with a lookup for the Percent variable.
- Check, publish and test the workflow.
|