Most workflow designers will create workflows to fulfill a specific business requirement. Examples of these, are the template workflows that are available to you when you go to create a new workflow using the Nintex Workflow designer (eg. Human Resources : Annual Leave template to fulfill the requirement of your staff who want to apply for leave).
You can save workflows as templates. This is one way of reusing workflows, but what this does, is let you create a workflow based on this Template. If 10 people in your organization create a workflow based on this template, then in effect, you have 10 almost identical workflows. You also need to remember that if someone updates the template, this will not be reflected in the workflows that have been made in the past based on this template.
Your other option, is to save your workflow (or part of the workflow) as a Snippet. This will only be available to the current workflow designer in the "My Snippets" group of actions. Again, you end up having the disadvantage that if you update the snippet, any workflows that used that snippet, will not be take advantage of latest snippet.
So how do we create something that is reusable, you can update and those updates will automatically be inherited by all workflows that use it ?
I'll warn you now. This is going to take some work, because the answer is creating a workflow that is about as generic as you can make it. We will look at a specific scenario.
A situation came up recently where we needed to update a Lookup field in a SharePoint list. The difficulty arose when that field supported multiple values and there just wasn't an easy way to update that field.
In case you don't know, updating a Lookup field with multiple values, using a CAML query, requires this format :
My input is a semi-colon delimited text string of colors. We need to use these colors to update the Lookup field of my current item.
So our task here is to convert this semi-colon text string into a valid text string that can be used to update the Lookup field.
Red;Green;Yellow --> 1;#Red;#2;#Green;#5;#Yellow
I'm not going to spend much time on the list structures. I think the screenshots will suffice.
My Color Lookup list :
My Test Update Lookup Field List :
We want to run a workflow, that takes the semi-colon delimited color list in the "Colors Text Value" field, and set the appropriate colors in the "Colors" lookup field (as show below).
Workflow that converts Red;Green;Yellow TO 1;#Red;#2;#Green;#5;#Yellow
I first create a List where I will store my reusable workflows, and I'll call it "Reusable Workflow List". I then create a single dummy item in that list, as that is what the workflow will run against. Below is a screenshot of the workflow.
The goal with this workflow, is to design it in such a way, that other workflows can run this workflow, get it to do some work, and then the original workflow can continue. The benefit of such modularity, is that your workflow end up being smaller and easier to maintain. The other great benefit, is that if you update such a workflow with a better algorithm for performing it's function, this update will automatically be inherited by every workflow that uses it.
In Part 2 of this article, I will go through the steps of creating the workflow mentioned above that can be called from other workflows.
Nintex Workflow - Workflow Re-use without Templates and Snippets - Part 2