Category Archives: Workflows

Reasons for Workflows failing

As I work with workflows I’ll be updating this post as I come across reasons as to why workflows fail to run.


1. Workflow History List Permissions

I’ve recently completed a lengthy approval workflow to which kept failing if an end user created the item, any user in the owners group worked correctly. The users had edit access on the list as well as the tasks list.

I noticed it kept failing at the start of the workflow as I have ‘log to history list’ to help understand where in the workflow I am in case of errors like this, as well as having statuses. I knew for sure users had full edit permissions on the two lists I created however, I didn’t think to check the Workflow History list permissions.

When having ‘log to history list’, users need to be able to edit that list in order for the workflow to log the item to the list which was my issue. I wasn’t using the default members group to group these users, I created my own groups which is why they never had access to that list, giving users access to that list made the approval work as expected.

As the history list is hidden, the easiest way to find this is to type in your SharePoint URL and add /lists/workflow%20history to the end.

https://sharepoint.com/tst/training/lists/workflow%20history

An alternative is to look in SharePoint Designer.
2. TBC

Workflow Approval Process

In recent months I’ve created many approval workflows for many different scenarios. In this post I will provide a step by step guide of how to create a basic approval workflow.

To start with I have a simple list, which has 3 approvers.
ApprovalWorkflow1
Stage 1

To start this workflow, open SharePoint designer, navigate to your list and create a new 2013 workflow. As per the screenshot below, in the ribbon select ‘local variables’, click add & input the name of the approver, I’ve done this three times due to three approvers (one for each approver).
ApprovalWorkflow2
Within the first stage of your workflow, click Actions in the ribbon and select ‘Set Workflow Variable’.

ApprovalWorkflow3

Fill out the details as follows:

In the top section:

Data Source: Select your list
Field from source: Select the column in your list
Return field as: Display Name

 

In the bottom section:

Field: Select the column in your list (same as Field from source)
Value: Press the fx and set the data source, field from source & return field as the above

Your variable should look something similar to the below.

ApprovalWorkflow4
When you click OK to close the ‘Lookup for String’ window, you will be greeted by the message below, just press Yes to this.
ApprovalWorkflow5

The last part for the first stage is to set the name of the stage, log to history list & then Transition to stage. To log what we’ve done to the history list, click ‘Action’ and select ‘Log to History List’. The reason this is done is for finding where in the workflow it gets to if any errors appear when ran. In order to transition to another stage, you will need to create another stage. This can be achieved by clicking the stage button in the ribbon (next to action).

If the above has been followed correctly, your workflow will look similar to the below.
ApprovalWorkflow6

 

Stage 2

I tend to keep the approval stage separate from everything else, which is the reason behind stages.

The first part of this stage is to create the task process.

  1. Select ‘Action’ in the ribbon, then ‘Start a task process’.
    ApprovalWorkflow7
  2. Click the ‘these users’ hyperlink for the window to open.
  3. Click the ellipses for Participants.
  4. Double click ‘Workflow Lookup for a User’
  5. Data Source: Workflow Variables and Parameters
    Field from source: Variable: Approval 1
    Return field as: Email Address
  6. Repeat steps 4 & 5 for the Approval 2 & Approval 3 Variable.
    ApprovalWorkflow8

Once complete, click OK and close the task process windows. Now create two more stages, name these ‘Approved’ & ‘Rejected’. Within the approval process stage, right click the Transition to stage area and choose ‘If any value equals value’. Click the fx for the first value and put

Data Source: Workflow Variables and Parameters
Field from source: Variable: Outcome
Return field as: ***Blank***

Now click the second value and choose approved. Within the IF statement, right click and choose go to stage, choose Approved, below the Else, do the same and choose rejected.

The end result will look like the below.
ApprovalWorkflow9

Stage 3 & 4

Stage 3 & 4 are similar to each other. The only real difference would be one is rejected and one is approved. Usually, once an item is approved or rejected, an email is sent out to the user who created the item to let them know it’s been approved however I shan’t go into detail on that. To finish the workflow, add an action of ‘Log to History List’ in both Approved & Rejected stages. On the Transition to stage, right click and choose go to stage, click the drop down and choose End of Workflow, this is for both the stages.

The end result is below. If you’d like to keep the user updated as to where in the approval this is, it may be ideal to use the ‘Set Workflow Status’ within the Actions in the ribbon. Alternatively, the workflow uses the Stage name for a status.

ApprovalWorkflow10

Duplicate emails on SharePoint workflow

Recently I’ve had the issue of having duplicate emails on SharePoint 2013 workflows, specifically approval workflows. There are no errors within the workflow however, when I looked at the workflow status I noticed that it had looped the stages, although this wasn’t the plan of course.

I had tried many a time to insert pauses to let the workflow jobs catch up but this never worked until I then inserted a 2 minute pause right at the start of the workflow, luckily enough this stopped sending duplicates.

Note: I did have to recreate the workflow and add the pause, the pause is vital as without, the issue still happened when recreating a new workflow.