Zoho Circuit

Zoho Circuit

Zoho Circuit is a platform that allows you to build nested tasks, create workflows with low or no code, and automate them. 

Workflows created in circuits are state machines that can trigger and track each step automatically, and retry when there are errors.

ServiceDesk Plus MSP Cloud executes circuits as custom actions in automation rules such as Request Triggers, Change Triggers, and Change Workflows when certain conditions are met.
 

States of Circuit   

States are building blocks of a circuit that can perform tasks, make decisions, or simply pass the output from one state to another.
 
You can build circuits with states using the drag-and-drop functionality in Builder View, or with simple JSON construction in Code View.
 
Circuit states are categorized as follows:
  1. Flow Controls
  2. Functional States
  3. Bridge Controls

Create a Circuit 

After you've enabled Zoho Circuit integrations,
  1. Go to Setup > Zoho Circuit > Circuits.
  2. Click New Circuit.
  3. Specify a name and a brief description.
  4. Click Save.
 
 
 
A circuit will be created, and you will be directed to the circuit builder page.
 
A sample circuit with the Pass state and name 'State1' will be created by default, and displayed as a visual workflow in Builder View. Similarly, in Code View, an equivalent JSON will be created by default.

Configure a Circuit  

You can configure a circuit in two ways:
  1. Builder View
  2. Code View

Builder View 

In the Builder view, you can construct the circuit as a visual workflow by dragging and dropping readily available states from the left pane.

The left pane contains all the states that you can add to a circuit and is divided into Flow Controls and Zoho CRM.
 
Define a Circuit 
To define a circuit in Builder View, you must add a state and define a state.
 
Add a State 
  1. Drag and drop the state from the left pane to the visual workflow.
  2. Enter a unique name for the state.
  3. Select the Previous State and the Next State between which the new state has to be added.
  4. Click Create.
 
 
 
Define a State 
  1. Click a state in the visual workflow.
  2. On the right pane, under Configuration, you can edit the state's name.
  3. The state's type is displayed based on your selection by default. You can still change it in the drop-down, but the previously saved definitions, if any, will be reset.
  4. In the case of functional states, select the name of the Function or Circuit to be associated with the state and define the error handling options.
  5. Under Input/Output, enter the Input Path, Output Path, and Result Path.
 
 
  1. Finally, click Save.

Info
Some state types have additional parameters. For example, the Wait state contains 'duration', and the Batch state includes 'Collection Path' and 'Collection Variable'. Similarly, the Parallel state requires 'Add Paths' and the Branch state needs 'Add Condition'. To learn more, explore Flow Controls.

All states except Success and Failure have Next State. The value End for Next State indicates that it is the final state of the circuit.

You can add dynamic input parameters for Functions using Add Parameter.

 
 Error Handling 
The error handling feature is supported only for functional states. Runtime errors are classified into the following four scenarios:
  1. On Timeout
  2. On Authorization Failure
  3. On Execution Failure
  4. Custom Error
 To handle errors when the function does not execute within the set time, you can choose to retry or have a fallback in place.
 
  1. Retry allows the function to execute again after a failure. You can set the number of attempts the function can retry execution, the time delay between every retry, and the step delay.
  2. Fallback allows the function to pass the error output to the next state when the function retries still result in an error.
Click here to know more about error handling.
 

Code View  

In the code view, you can directly code a circuit in the JSON format. A state name is a JSON object, and its properties are the key-value pairs of that object.
 
Properties like type and next are commonly used for all states. If a state does not mention the next key, it is the last state in the circuit. If a state is not referred to as next in any other state, it is the first state of the circuit.
 
Info
 Follow the standard JSON syntax while coding a circuit. 
 
Define a Circuit 
Follow the steps given below to define a circuit in code view:
  1. States consist of attributes. Enter a state name and define the attributes for the state as key-value pairs.
  2. Define the common fields of the state: name, type, and next.
    1. name: All the states must have a unique name to identify them within the circuit.
    2. type: The actual functionality of the state is referred to by its type. The supported types are pass, branch, parallel, wait, batch, success, failure, function, webhook, and circuit. Click here for more details on states.
    3. next: The name of the next state to run after the completion of the current state.
  3. Define the unique fields of the states. Refer to Flow Controls to explore the fields for each state.
  4. Provide error handling options using the onError attribute for state types, Functions, Webhooks, and Circuits.
  5. Specify the inputPath, outputPath, and resultPath for input and output processing.
  6. Click Save.
 

Info
When there is an error in the code, a red mark is displayed beside the error line. Hover over it to display the details of the error.

Every circuit must have one state with the field value start: true to represent the beginning state.

All states except success and failure must have a next state. The terminal state must have the next state value as End.

You can define the states in any sequence. The order of execution depends on the start and next fields.

All fields and their values are case-sensitive. Once you define a value, you must provide the exact value throughout the circuit.

All the standard attribute names of the state (name keys are represented in black in the Code View) like type, next, duration, functionName, and collectionPath are expected in the camel case.

Bridge Controls  

Bridge Controls allows you to perform certain operations in an application, a database, or a computer in a private network. Some of the tasks in these controls require the Bridge agent to be deployed and active in the end user's network.
 
The following are the advanced controls:
 
  1. Task Engine: Connects and accesses an API from a closed space. Know more.
  2. DB Task: Executes query of the database hosted in a private network. Know more.
  3. SSH Task: Performs action using the Shell command in a bridge-installed Linux machine. Know more.
  4. Files: Creates workflows for file management. Know more.
    1. File Upload
    2. File Transfer
  5. AD Task - Integrates and performs action in the AD service of the client application. Know more.
    1. Add AD User
    2. Add AD Group
    3. Add User to Group
    4. Add AD Computer
    5. Enable AD User
    6. Disable AD User
    7. Reset AD Password
    8. Unlock AD User
    9. Remove AD Object
    10. Update AD Object
    11. Read AD Object
  6. PowerShell Task Engine - Performs action using PowerShell command in a bridge-installed Windows machine. Know more.
    1. PowerShell Engine     
    2. Install WindowsApp
    3. Uninstall WindowsApp     
    4. Start Service
    5. Stop Service
    6. Restart WindowsServer
Info
States share many common features:       
Each state must have a type field indicating what type of state it is.   
All states except for success and failure states require a next field, or they can be a terminal state by specifying an End field. 

Test and Execute a Circuit 

After configuring a circuit,
  1. Click Save or Save and Execute.
  2. When you click Save and Execute, a pop-up will appear with a predefined input. You can either select a value from the existing request or provide the JSON input for the circuit as key-value pairs and click Next.
 
    
  1. Set or modify the values passed to test the circuit.
 
    
  1. Click Test Run. You can view the execution in progress.
 
 
 
  1. In the event of failure or data mismatch, you can repeat the execution by clicking Run Again.
Info
 Each circuit can have multiple simultaneous executions. 
 

Execution Logs 

Execution Logs record all the executions in Circuits. You can view the execution logs specific to requests or changes. From execution logs, you can select and re-run a specific execution anytime.
 
To view all the executions,
  1. Click Execution Logs on the top of the circuit's page. This opens a list of all the executions of the circuit, along with the Circuit Name, Request ID, Invoked Time, Status, and other details.
 
 
Under Circuit Name, click a name to view its complete execution details. The execution page comprises the following tabs:
  1. View Graph
  2. View Code
  3. View Logs

 View Graph 

You can view the live execution of the circuit.
  1. Once the circuit has been executed, you can visually observe the Execution Details, such as the input, output, and duration of the execution, from the right panel.
  2. If the execution takes more than the expected time or seems to run in a loop, you can click Stop Execution to terminate it anytime.
  3. You can view the paths that were traversed in the circuit, the status of each state represented by a color code mentioned at the top, and the overall status of the circuit execution as well.
 
When you click a particular state, a pop-up displays the detailed information of that state's execution.

 

View Code 

View Code allows you to navigate to the circuit's Code View from the execution page. This helps to instantly modify the circuit's code after you observe the execution.

 

View Logs 

The logs provide details of the task execution in each state. The detailed log enables you to assess failures effectively and detect bugs in each state's execution in a circuit.

 
 
The following details are displayed in the logs:
  1. Timeline: The date and time of a particular event in a state, along with icons to indicate the event type.
  2. State: The name of the state in which a particular event is executed.
  3. Event: Events that occurred in the states, such as State Entered, State Exited, Input Processing, Result Processing, State Machine Triggered, State Machine Executed, etc.
  4. Payload: JSON input that was passed to that state of the circuit.
  5. Parameter: Additional parameters that are provided by the user to the state's input function and batch states.
  6. Response: Response or the output generated by the state after its execution.
  7. Exception: Tracks down the errors or any exceptions that occurred while executing the state.

    • Related Articles

    • Zoho Circuit Integration

      ServiceDesk Plus MSP Cloud integrates with Zoho Circuit to help you automate complex workflows by systematically defining and organizing a sequence of tasks. You can use functional tasks such as SSH Task, DB Task, AD Task, Task Engine, and PowerShell ...
    • Zoho Survey

      ServiceDesk Plus MSP Cloud integrates with Zoho Survey, which enables users to create survey templates and evaluate customer responses in real time. Zoho Survey enhances the usability of surveys in a help desk and allows users to create multiple ...
    • Zoho Survey Integration

      ServiceDesk Plus MSP Cloud integrates with Zoho Survey, a powerful survey-building tool. With Zoho Survey, you can create user-friendly surveys in minutes and gain valuable customer insight to improve your help desk service. Role Required: SDAdmin ...
    • Incident Workflow Editor

      The Workflow Editor enables you to build a directional pathway for the service request to follow through its life cycle. The workflow editor is provided with an expandable, scrollable canvas for creating workflow diagrams and a collapsible stencil ...
    • Problem Workflow Editor

      The Workflow Editor enables you to build a directional pathway for the problem to follow through its life cycle. The workflow editor is provided with an expandable, scrollable canvas for creating workflow diagrams and a collapsible stencil panel. You ...