Nested workflows

jetFlow.io > Documentation  > Creating Workflows  > Nested workflows

It is possible to create complex workflow structure by using nested workflows with no efforts.

What does nested exactly means? This is an ability to run (invoke) another arbitrary workflow during execution of main workflow. Main workflow means calling or parent workflow which has started earlier.

Suppose that your workflow needs some functionality that is already performed by another workflow on your website. Rather than attempt to replicate the same functionality, you can add a step to invoke the other workflow as needed. A workflow that invokes another workflow is the calling or parent workflow. A workflow that is invoked by another workflow is the called or child workflow. On completion, the called workflow returns control and result of execution to the calling workflow.

From the point of view of the calling workflow, the called workflow is simply another action to be performed. You define the called workflow in a Run another workflow action.

With the ability to call one workflow from another, you can follow a modular approach to designing workflows. You can include a common, frequently performed, action in one workflow and allow other workflows to call that workflow, as needed.

Run another workflow

To define nested workflow to run and conditions to check use Run another workflow action. You can use this action in a workflow as many times as you want. Using that way, you can initiate execution different workflow with different conditions or without any condition to automate complex tasks which will meet requirements of your business processes.

If you need to run workflow conditionally choose appropriate logic type and configure set of rules to check.

Note: Run another workflow action starts execution of selected workflow with a trigger. So, the trigger will always be executed, and in some circumstances, it may just stop the execution without executing the rest of actions in a child workflow.

Passing parameters

Specify values, passing to a called workflow as parameters, by using patterns or just text value. If you want to pass a certain variable without type conversion (typecasting), you need to specify only a pattern any kind. If you specify more than one variable by using several patterns, all variables will be converted to a string containing respective values.

Example 1. Keep structure and type unchanged, list of data

{$post}

Example 2. Keep type unchanged, integer number like 123

{$post[ID]}

Example 3. Become a string like “123 My lovely post title”

{$post[ID]} {$post[post_title]}

Getting result of the execution of called workflow

You can get value returned by nested workflow by using pattern {PREVIOUS} in the next action in the parent workflow. One thing you should not forget: in the child workflow you need to use one of control actions which will return some value. It may be Stop if or Return it action.

Limitation

  1. You can select only workflow which have Enabled status at the moment of editing parent workflow.
  2. You can not recursively call workflow itself or by using another intermediate workflow.

 

No Comments

Sorry, the comment form is closed at this time.