Recently I was presented with a problem that I’m sure many of you have faced but it took some thinking – not an easy task for me – on the best way to resolve it. Let me give you a run down on the problem and then speak about the solution in more generic terms.
We have a list that is used to store various types of equipment that is available throughout our organization. We have a parent content type of Equipment Item and about 18 child content types including Robot, Welding, Plant Equipment etc. When equipment is identified and agreed to it is entered into this SharePoint List which initiates a SharePoint Designer(SPD) workflow. There are a few steps and then a Collect Data from a User action is called. This action creates a task for the specified user which in our case is where they specify the status of the equipment. With me so far?
Here is the problem. There are currently approximately 300 active workflows and the volume of activity is going to increase significantly over the next few months. The Collect Data from a User action however creates a task with a generic title and description like so:
You can see what the issue is – how do I quickly tell which task is associated with which piece of equipment? You could click on the Link column to see the item however that is time cosuming and very cumbersome. What we need to do is pull some key data from the equipment list into the associated task. What makes a little trickier than it appears at first blush is the fact that until the user provides the required data to the workflow the Collect Data from a User essentially pauses the workflow. This means that we can’t add a step in the workflow to update the task with pertinent information until after the user acts on it which is after he needs the pertinent information.
The solution in this case is to create a secondary workflow on the task list that will be automatically triggered when a new item is created. This workflow will then go back to the related item in the equipment list and pull in the required information. We will use the Update List Item action in order to accomplish this.
In this case we are updating 3 columns from the Equipment list but in the interest of keeping things concise we’ll focus on 1. Since the workflow is being initiated on the Task list will will want to be updating the current list item. We’ll be updating the SubCategory field, which is a column that we added to the Task list with the value of the Sub Category column from the Equipment list.
Defining the workflow look up is the key to making this work. We know that these tasks must be associated with the specific Equipment item but how can we make sure we are looking up the values from the right piece of equipment? Each list by default has a unique identifier called ID. The task list also has a column called Workflow Item ID which is the ID of the related list item. So by looking up the ID of the piece of Equipment that corresponds with the value of the Workflow Item ID in the Task list we will be able to grab the correct data to populate our Task list.
I hope you found this information helpful and any feedback is welcome.