I happened to come across this requirement to start a new Nintex workflow from another workflow. Now obviously that is no big deal, we have the Nintex action “Start Workflow” that can be used directly. But my need was a bit different which led to this post. 🙂
The requirement was to pass variables between workflows when starting a workflow A from workflow B. Usually, such a situation arises when the workflow is very large in size and is split to multiple smaller workflows to improve performance. In that case, we need variables to be passed from the parent to the child workflow.
To achieve this, variables need to be created in the second workflow and below two actions need to be configured in the parent workflow.
These variables can then be populated automatically in the second workflow when it is started from the first workflow through Nintex web service action.
Step 1 – Create your second workflow, then create variables in it that you want to be populated.
In the example demonstrated below, start variable created is
txtLeadershipEmail – Single line of text
Step 2 & step 3 need to be performed in the first/parent workflow.
Step 2 – The workflow variable “txtLeadershipEmail” (created in the second workflow) needs to be set to some data when the second workflow starts. To set the data to this variable, a “build dynamic string” action is created that creates the association Data
Association data looks like below
This will set the variable txtLeadershipEmail to the value being passed
Step 3 – The secondary workflow is started using a web method “StartWorkflowOnListItem” of the webservice “Workflow.asmx”. Below is the configuration
Please ensure Encode inserted tokens is selected.
And you’re done. This will start the secondary/child workflow (or the “Test Approval WF” here) with the parameter being set to the value that you passed in building the association data.