A SharePoint Workflows tutorial by Peter Kalmström
some earlier Tips articles, Peter Kalmström, kalmstrom.com
CEO and Systems Designer, has described different ways for
organizations to handle the approval processes for new or
changed library files.
In this article we will look at how the process can be automated
when several people need to approve documents, one approver
after another. Each of these approvers can stop the process
by rejecting the document.
In the demo below, Peter describes how to create a SharePoint
2013 workflow that runs automatically when a new document
is added to a SharePoint document library. This workflow
focuses on user friendliness and the possibility to track
the approval process.
Note that this is a totally custom solution, neither using
the built-in approval status column nor any of the out-of-the-box
workflows that Microsoft supplies. The benefit of using
a custom approval solution is that it gives you total control
of the process. The downside (as you will see) is that the
workflow is rather complex and time-consuming to create.
A document library with
A Yes/No choice column for "All Approved", displayed
in the default view.
A Yes/No choice column for the approval decision,
"[TEAM] Approved", not displayed in the default
view but used in the workflow.
A Person or Group column for the approver, "[TEAM]
Approved By", not displayed in the default view
but used in the workflow.
A list that contains the different teams as
items. Each item has the team name in the title and the name of the approver in a Person or Group column.
For easy testing of the workflow, add yourself as
the approver for all teams and change the names
when the workflow is finished. This change of approver
does not affect the workflow function, so it can
be done anytime.
Each step in the approval process is represented by a stage
in workflow. Peter uses as many as five approvers, but this
workflow can of course be used for any number of approvers,
as long as they are more than one. Just create as many stages
as you need!
"Waiting for [TEAM] approval" Stages
Create this stage for each approver, or create one stage,
copy it and change applicable fields for the other stages.
Start the workflow. Action: assign a task
User: lookup Approver in the list and return
as User Id Number. The list item should have approver's
team name in the title.
Task: Lookup for the document name. Wait for
task completion (to have all approvals in a sequence).
By default, the outcome is set to 'Approved'. This
info will be stored in a workflow variable.
Check if the document is approved. Condition: If
value equals value. If the Outcome workflow variable
Update the document's approval status column.
Action: Update List Item.
Set the "[TEAM] Approved" to Yes.
Set the "[TEAM] Approved By" to Yes. Lookup
Approver in the list and return as User Id Number.
The list item should have approver's team name
in the title.
Go to the next stage. When you have created
the next stage, it can be selected at 'Go to' in
the previous step.
"[TEAM] Rejected" Stage
When all the "Waiting ..." stages are finished, add a "[TEAM]
Rejected" stage for each of them and let this stage go directly
to the end of the workflow.
Under 'Else' in the condition of each "Waiting ..." stage,
replace Go to the end of the workflow with Go to the rejected
stage for the team than rejected the document. That way,
the rejection will be shown in the library approval status
All Approved Stage
When a document has been approved by stakeholders, the stage
for the last one should go to an "All Approved" stage, and
the document library should be updated to show that.
Action: 'Update List Item'. In the current item,
set the "All Approved" field to Yes.