Workflow Controls

Introduction

The workflow process takes over after the front-end form is submitted. Workflow (using the Task Engine) has the ability to update and retrieve from numerous other systems, perform calculations (using Ruby), and dynamically determine process steps.

Goals

Learn about the included system controls

Workflow Controls Video

Basic Controls

These controls aren't covered in the video, but are used in many trees.

More details are available in the platform documentation.

No Operation

As the name states, this node doesn't have any function beyond a marker or place-holder. Still, those two options make it one of the most often used.

Echo

The original purpose for an echo node was to "echo" values out during the Run for testing and troubleshooting. However, you can run just about any Ruby code you want in an echo node, so they are now used to perform calculations, extract variables, process complex strings, or any number of other operations in a workflow tree.

Wait

The Wait node is the most acurately named node in this group. You give it a time unit (second, minute (most common), hour, day, week) and a number to match and it will defer (wait) until that time before completing. This control is often used with SLA, or delayed notifications.

Defer

Plain deferred nodes stop the flow of processing until a trigger restarts them. When the deferred node fires, it makes a token available for any triggers that could use it. Examples of use include approvals, or incident/change ticket creation. Any process that needs to stop and wait for a decision or change in status is a candidate for deferral.

Create Trigger

Create Trigger nodes complete (or update) deferred nodes, but they also have the ability to pass results and messages to deferred nodes.

Create Trigger nodes must have a Token (see above) to identify the deferred node being acted upon.

Results must be in the following format:

<results>
<result name="Name A">Value A</result>
<result name="Name B">Value B</result>
</results>

Messages do not have a specific format.

Advanced Controls

Joins/Junctions are covered in the video. Loops are covered more completely in the platform documentation.

Join and Junction

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

Join nodes only track the connectors that are directly connected to it. There are three settings that determine if the node completes and continues processing.

Example Join Node:

V5 Join Example

  • All - each connector combining 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

Junction

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

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 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 Input:

<list>
  <item>han</item>
  <item>luke</item>
  <item>rey</item>
</list>

Example Loop:

V5 XML Loop

You can also process a loop using JSON as the input. In this case, you use JsonPath to parse values - https://github.com/json-path/JsonPath

Example Input:

{
"cars": [
  {
    "make": "honda",
    "model": " pilot"
  },
  {
    "make": "honda",
    "model": " CRV"
  },
  {
    "make": "Ford",
    "model": " Explorer"
  },
  {
    "make": "Ford",
    "model": " Edge"
  }
]

}

Example Loop:

V5 Loop Process JSON

With the shown JsonPath, the output each time through the loop is the Model Name of the Car.

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

Next, we learn about Routines and how to construct and use them in workflow.

Story for the Class

As a new Kinetic Admin, you have been tasked with cloning an existing Facilities form to collect more information. You also need to construct a basic notification after it's submitted.