Circuits

Circuits

The main purpose of Zoho Circuit is to build efficient circuits in the form of workflows to coordinate multiple microservices. Circuits are state machines that can trigger and track each step automatically, and retry when there are errors. 

Setting up circuits involves three steps:
  1. Create a Circuit
  2. Define a Circuit
    1. Builder View
    2. Code View
  3. Test a Circuit

Create a Circuit

To add a new circuit:
  1. Log in to the Zoho Circuit console.
  2. Select Circuits from the top menu bar and click +New Circuit in the top-left corner. Alternatively, you can also select +Create New in the top-right corner of homepage and select Circuits.
  3. Specify a unique Name for the circuit.
  4. Add a Description for the circuit.
  5. Click Create
            

Define a Circuit

After circuit creation, a sample circuit with pass state as 'State 1' will be created by default, and displayed as a visual workflow under Definition.
You can define circuits in two different ways:
  1. Builder View
  2. Code View 
With Builder View, you can construct your circuit as a visual workflow by dragging and dropping states from the left pane that contains Flow Controls and Functional States. Add configuration parameters for the states using the right pane with the Configuration and Input/Output settingsIn Code View, create circuits with simple, predefined JSON construction. 
 
For every change made in builder view, the equivalent JSON text is appended automatically in Code View, and vice versa. You can observe this by making a change in one view, then check it out the circuit in other view.

Builder View

Using Builder View, you can construct your state machine as a visual workflow by integrating the readily available state components and setting up their configuration. The left pane in the builder view consists of all the states that can be added to a circuit. States are building blocks of a circuit that can perform tasks, make decisions, or simply pass the output from one state to another. 

      
 
States are classified into two categories: 
  1. Flow Controls
  2. Functional States
Flow Controls lets you control the flow of your circuit. For example, using a flow control state called 'Pass', you can pass your input from one state to another; using state 'Success', you can stop the execution of your circuit.
Flow Controls consist the following seven states:
  1. Pass
  2. Branch
  3. Parallel
  4. Wait
  5. Batch
  6. Success
  7. Failure
Functional States helps you to execute business logic in circuits. You can achieve this by writing functions in the built-in editor, creating links for webhooks, or by associating a circuit within a circuit. There are three functional states:
  1. Function
  2. Webhook
  3. Circuit


Construct a circuit in builder view using two steps:
  1. Add a state
  2. Define a state 

Add a state in Builder View

To add a state in a circuit:
  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 Next State between which the new state has to be added.
  4. Click Create.
            

Define a state in Builder View

To define parameters for an added state:
  1. Click a state in the visual workflow.
  2. On the right pane, under Configuration, you can optionally edit the state Name.
  3. The state Type is selected based on your selection by default. You can still change it in the dropdown, but the previously saved definitions, if any, will be reset.
  4. In the case of functional states, select the name of the Function, Webhook 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. To know more about I/O paths, click here.
  6. Click Save in the top-left menu bar.
            
 
Points to ponder
  1. Some state types have additional parameters. For example, the 'Wait' state contains 'duration', and the 'Batch' state includes 'Collection Path' and 'Collection Variable'. Similarly, 'Parallel' state requires 'Add Paths' and 'Branch state' needs 'Add Condition'. To know more, explore Flow Controls.
  2. All states except 'Success' and 'Failure' have 'Next State'. The final state of a circuit is defined by having 'Next State' value as 'End'.
  3. Dynamic input parameters can be added for 'Functions' using Add Parameter and for 'Webhook' using Add Parameters and Add Headers.
Working in Builder View
The following options near the left pane serve to better illustrate the visual workflow.
      Click the Zoom In icon to increase the size of the circuit.

       Click the Zoom Out icon to shrink the circuit size.
 
       Click the Auto-arrange icon to place the circuit in the center of the page.
 
       Click the Change view icon to horizontally position the vertical circuit and vice versa.

Code View

In Code View, you can define your state machine in a simple JSON-based, structured language. Once a circuit is created, a sample workflow with pass state as 'State 1' is created by default.
      
To define a circuit in Code View:
  1. States consist of attributes. Enter a state name. Define the attributes for the state as name value key pairs. Equivalent visual representation for the code changes can be viewed by clicking the refresh button 
  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. In the circuit displayed above, 'State 1' is the name of the circuit.
    2. type - The actual functionality of the state is referred by its type. The following types are supported:
      1. pass
      2. branch
      3. parallel
      4. wait
      5. batch
      6. success
      7. failure
      8. function
      9. webhook
      10. circuit
    3. next - The name of the next state that has to be run after the completion of the current state is provided by next. 
  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 'function', 'webhook', and 'circuit'.
  5. Specify the 'inputPath', 'outputPath', and 'resultPath' for input and output processing. 
  6. Click Save in the top-left menu bar. 
In the event of an error in JSON definition, a red cross mark []  will be displayed beside the error line. Upon hovering on the icon, the reason for the error is displayed.

Points to ponder
  1. Every circuit must have one state with the field value 'start: true' to represent the beginning state.
  2. Each state can have only one 'next' state, except 'branch'. This is because each condition within branch must have a 'next' state.
  3. All states except 'success' and 'failure' must have a 'next' state. The terminal state must have the 'next' state value as 'End'.
  4. States can be defined in any sequence. The order of execution solely depends on the 'start' and 'next' fields. 
  5. All fields and their values are case-sensitive. Once a value is defined, the exact value must be provided throughout the circuit. 
  6. All the standard attribute names of the state (name keys represented in black in Code View) like type, next, duration, functionName, and collectionPath are expected in camel case.

Test a Circuit

To test your circuit:
  1. After saving your circuit, click Test Run in the top-left corner.
  2. Specify the test data as Input JSON for your test run, then click Next.
  3. Name your test run for this execution.
  4. Click Run. You can view the execution in progress. The execution run can be seen visually. To learn more about Executions, click here.
In the event of failure or data mismatch, you can repeat the execution by clicking Run Again or Test Run.
All the previously saved circuits and executions can be viewed using the Versions and Executions options.
 

Versions of a Circuit

Whenever a saved circuit is modified, a new version of the circuit is created. In Zoho Circuit, all the older versions are saved and can be viewed at any time. To view the all the versions of a circuit:
  1. Log in to the Zoho Circuit console
  2. Select Circuits from the top menu bar.
  3. Click the circuit name.
  4. Click the Version option from the top menu bar.
  5. The saved versions of the selected circuit are listed with the following details:
    1. Version Name
    2. Modified On
    3. Modified By
    4. Action
      1. View - Select to view the corresponding version of the circuit.
      2. Delete - Select to delete the chosen version of the circuit. 
            

    Access your files securely from anywhere

      Zoho CRM Training Programs

      Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

      Zoho CRM Training
        Redefine the way you work
        with Zoho Workplace

          Zoho DataPrep Personalized Demo

          If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

          Zoho CRM Training

            Create, share, and deliver

            beautiful slides from anywhere.

            Get Started Now


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION









                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      Zoho Sheet Resources

                                                       

                                                          Zoho Forms Resources


                                                            Secure your business
                                                            communication with Zoho Mail


                                                            Mail on the move with
                                                            Zoho Mail mobile application

                                                              Stay on top of your schedule
                                                              at all times


                                                              Carry your calendar with you
                                                              Anytime, anywhere




                                                                    Zoho Sign Resources

                                                                      Sign, Paperless!

                                                                      Sign and send business documents on the go!

                                                                      Get Started Now




                                                                              Zoho TeamInbox Resources



                                                                                      Zoho DataPrep Resources



                                                                                        Zoho DataPrep Demo

                                                                                        Get a personalized demo or POC

                                                                                        REGISTER NOW


                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now









                                                                                                              • Related Articles

                                                                                                              • Functions

                                                                                                                  Function is a program script that performs a set of operations whenever invoked within an application. Set up functions in Zoho Circuit to actualize your business routines. Circuit's functions are serverless, where the cloud provider dynamically ...
                                                                                                              • States in Zoho Circuit

                                                                                                                In Zoho 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 ...
                                                                                                              • Introduction to Zoho Circuit

                                                                                                                What is Zoho Circuit? Zoho circuit is a platform for integrating microservices to create automated workflows. With sophisticated flow controls, you can create custom applications or processes as workflows, without writing any code. Workflows created ...
                                                                                                              • Input and Output Processing

                                                                                                                  Understanding how Zoho Circuit processes input and output as the data flows through the circuit helps to design and implement effective workflows. A circuit execution receives input as a JSON, then passes that input to the first state. Each state ...
                                                                                                              • Webhook

                                                                                                                Webhook enables communication between third-party applications and Zoho Circuit. With webhooks, you can make API calls and notify the applications whenever an action takes place in Zoho Circuit.   Set up webhooks in the following three steps: Create ...
                                                                                                                Wherever you are is as good as
                                                                                                                your workplace

                                                                                                                  Resources

                                                                                                                  Videos

                                                                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                  eBooks

                                                                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                  Webinars

                                                                                                                  Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                  CRM Tips

                                                                                                                  Make the most of Zoho CRM with these useful tips.



                                                                                                                    Zoho Show Resources