Configure Branch state in Circuit | Qntrl | Circuit | Online Help

Branch

The Branch state allows you to add conditions to the circuit's workflow and execute tasks based on those conditions. It decides the path of execution based on input to this Branch state. This is similar to having an 'If else' or 'switch' case.
A Branch state may have more than one 'Next' state, but only one of the branch states will be executed. A branch state cannot use 'End' state.

Use Case Example: In the case of employee onboarding, after the employee details are provided, the submitted documents undergo verification. To handle appropriate action after verification, the Branch state can be employed based on the input received. If the verification status is determined as 'success', the circuit will proceed to the next pre-configured state. On the other hand, if the verification status is identified as 'failure', the circuit will follow a different path to the configured state.
 

Let us see how to configure the Branch state in Builder View and Code View.

Builder view

To configure a Branch state to your circuit:

  1. In Builder View, drag and drop the Branch state from the left pane into your circuit or click the required branch state of the circuit.
  2. Under the Configuration tab, update the common state field attributes.
  3. You can include branches within this state by selecting Add Condition. This feature allows you to incorporate a state and define conditions for its execution. Upon meeting the condition for each branch, the specified subsequent state will be executed.
  4. In Condition add $.verification == 'success' field set the next Success state in Go To.
  5. Similarly, you can add another condition as $.verification == 'failure' and set it to a Failure state in Go To.
  6. You can configure the Input and Output Paths of the Branch state as described in Input and Output Processing.
Branch state has a default pathway that you can link with the next state of the circuit. If none of the conditions is followed, the state will be executed with the default branch.

  

The following 'Condition' operators are supported:

               Operator

                Description

&&

And

==

Boolean Equals

!=

Not

==

Numeric Equals

>

Numeric Greater Than

>=

Numeric Greater Than Or Equals

<

Numeric Less Than

<=

Numeric Less Than Or Equals

||

Or

==

String Equals


Code View

In Code View for Branch, each branch must have Condition and Next fields.

The JSON to configure the Branch state for the above example is:

"Action - Approve or Reject": {
"type": "branch",
"next": "Verified and Approved",
"branches": [
{
"condition": "$.verification == 'success'",
"next": "Verified and  Approved"
},
{
"condition": "$.verification == 'failure'",
"next": "Verified and Rejected"
}
]
}




NextParallel state

    • Related Articles

    • Sample Use Cases

      Payment process In a typical payment process, for every purchase made, a payment link with the invoice will be shared with the purchaser. Upon successful payment, a receipt will be generated; in the event of failure, the entire process will have to ...
    • Wait

      The Wait state introduces a pause or delay within your circuit, temporarily halting the execution for a specified duration before resuming and progressing to the next state. The delay duration can be configured in seconds. For example, if you set a ...
    • Success

      A Success state can be used to terminate an execution. It is used to represent a successful execution for the user's reference. As Success states are end states, they don't have any configuration or properties, such as Next state or End fields. You ...
    • Parameters in Circuit

      Parameters in Circuit allow you to use dynamic values in your automated workflows, making it easier to customize and control various parts of your process. These parameters are created in the ConfigStore and can be referenced throughout the different ...
    • Result Selector and Result Path

      Result Path and Result Selector are employed to extract dynamic data from the state's result when the execution is successful. Result Selector Result Selector lets you retrieve and process the runtime data, enabling flexible and dynamic data ...

    You are currently viewing the help articles of Qntrl 3.0. If you are still using our older version and require guidance with it, Click here.