The workflow engine comes with utilities to help process trees. In this article you'll learn about loops, joins, and other system controls.
Understand how to use the included utilities.
A No Operation node (known as a NoOp), doesn't perform a function and is used as a label or placeholder in a tree. The only option for change is to update the name of the node.
The Wait node is used to pause workflow for a specific amount of time. By definition it is deferred, but instead of another process creating the trigger, it is determined based on inputs to the node.
It's common for another node in the tree to provide the wait time (often an Echo node).
The defer node is used to stop processing and wait for a specific event. It can be used as part of a process, or as part of troubleshooting. The deferred node generates a token that needs to be used by any trigger that wants to complete or update the node.
If it's being used just for troubleshooting (or you need to keep a process moving that has errored out), you can complete a deferred node directly from the corresponding task in the Run.
Example Completed Deferred Node:
Echo nodes are the most flexible option available as part of a tree. The original purpose was to "echo" values back to the tree builder as part of troubleshooting. However, you are also able to add "any" Ruby code to the body of the node and perform a wide variety of functions that can be passed to other nodes in the tree.
Here is a complex example from a Kinops tree:
The Create Trigger node is used when you want to complete a tree that has stopped on a deferred node.
Example Create Trigger Node:
While the Action Type defaults to Update, Complete is more common. Deferral token is how the engine finds the correct node to update or complete.
Deferred results lets you pass information back to the node. For example you can pass the results of an approval decision or a ticket number that can be used in the continuing process. Deferred results are formatted as XML, and must have the following format:
<results> <result name="Name A">Value A</result> <result name="Name B">Value B</result> </results>
Join and Junction have the same overall function, they bring together different tree branches. However, they have different ways of tracking when they should allow processing to continue.
Join nodes only track the connectors that are directly connected to the node. There are three settings that determine if the node completes and continues processing.
Example Join Node:
- All - each connector coming into the join is complete
- Any - the first complete connector completes the join
- Some - set the number of connectors that the join tracks before completing
Instead of just tracking the connector, a Junction node tracks the entire branch back to a common parent node. If the branch is as complete as it can be, the junction marks it as complete. As soon as all the branches are complete, the junction completes and continues.
A branch is complete as long as it's done as much as it could. This means that all nodes that can complete have, and all connectors have been evaluated, even if they are false. If a node in the branch is deferred and not completed, the branch is not complete. If the first connector in the branch has a qualification that evaluates to false, the branch is complete.
Because the engine tracks each branch connected to a junction, there are no settings in a junction node.
Loops are used to process a known number of transactions in the same way. There are three parts to the loop process. Define the beginning (Head) of the loop and set the number of times through (XML or JSON string). Second, define the end of the loop (Tail) and the criteria for exiting. This is the same as a join node. Lastly, define the nodes within the loop. Each time through the loop goes through the same workflow.
Example Loop (XML):
Loop in the builder:
Input (original CSV = han,luke,rey):
Loop Head Details:
The Loop path of //list/item tells the loop how to navigate to the specific elements for processing.
Example Loop (JSON):
Here is the JSON input:
Here is the Loop Head:
The loop path of $.cars.[*].model determines how the JSON is navigated and what values are available to process.
Loops are not meant to process until a certain value. For something like that you can use a Routine in the next article.
In the next article, you learn how to create shareable workflows called Routines
Updated 10 months ago