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

Batch

Batch state allows you to execute a Function, Webhook, or Circuit in batches as multiple jobs in an iterative manner.


While the Parallel state executes multiple states simultaneously using the same input, the Batch state executes the (same set of) State(s) for multiple entries of an array in the state input. This helps to handle a large volume of input or tasks in sets rather than overloading the involved resource. 

Collection Path

The Collection Path field in the Batch state allows you to specify an array within an input JSON for the state to iterate over. This is particularly useful when you have a JSON input that contains an array of items, and you want to process each item individually within the Batch state. Use JSONPath syntax to specify the location in the input of the JSON array used for iteration.

 

Let us consider the following JSON input:
{
    "employee_list": [
        {
            "name": "John",
            "email": "john@zylker.com",
            "role": "Business Analyst"
        },
        {
            "name": "Helena",
            "email": "helena@zylker.com",
            "role": "Programmer"
        },
        {
            "name": "Mark",
            "email": "mark@zylker.com",
            "role": "QA Analyst"
        }
    ]
}
Every index in the above input can be iterated, set to a variable, and sent for processing using the collection path $.employee_list.

Collection Variable

The Collection Variable is used to store the JSON values that need to be processed in the associated resource (Circuit, Webhook, or Function states) of the Batch state.

 

For example, if we want to process the employee details of each employee from the 'employee_list' array in the above JSON input, in the Batch state configuration, set the Collection Path as $.employee_list and the Collection Variable as an employee. This will extract each employee object within the 'employee_list' array and assign it to the 'employee' variable.

 

If the associated resource is a Circuit, the values from 'employee_list' will be processed using the collection variable. The values in the Collection Variable can be used as $.employee.name, $.employee.email, $.employee.role in the Circuit.

 

Example Use Case: In the employee onboarding scenario, a circuit named 'New Employee Onboarding' is already designed for the onboarding of a single employee, which has a predefined sequence of steps or actions to be followed during the onboarding process. However, to onboard multiple employees efficiently, we can execute the circuit in batch mode for multiple entries of employee details using the batch state. Each entry represents an individual employee going through the onboarding process, ensuring that each step of the process is followed consistently for all employees.

 

This enables us to onboard multiple employees simultaneously. By setting the number of jobs in the Batch state, let's say 10, the circuit can be executed concurrently for 10 employees, processing their respective inputs. Once the initial 10 jobs are completed and the first set of employees is processed, the subsequent iteration will initiate the next batch of 10 jobs to onboard the next set of employees. This iterative process continues until all employees are successfully onboarded.

 

Now, let's configure a Batch state in Builder View and Code View for executing multiple employee onboarding circuits as a batch.

Builder View

To configure a Batch state to your circuit:

  1. In Builder View, drag and drop the Batch state from the left pane into your circuit or click the required Batch state in your circuit.

  1. Under Configuration, update the common state field attributes.

  1. In the Collection Path, enter the key that contains the JSON array with the values to be processed by the Batch state in the input JSON.

  1. In the Collection Variable, provide a variable name to hold the JSON value or object extracted from the list specified in the Collection Path. The iterated JSON value or object can be accessed using this variable.

  1. Using Bind Type, you can bind the Batch state to a Function, Webhook, or Circuit.

In this process, we are binding circuit developed for single employees onboarding and executing as a batch for multiple employees during the employee onboarding process.

  1. In the No. of Jobs field, define the number of threads for each batch.
  2. In the Input/Output section, configure the paths for the Batch state; refer to Input & Output Processing. 
      

Since multiple instances of a function or a circuit are executed, this ensures that they do not face a timeout error.

‌If you define the Retry option for the Batch state, the retry policy applies only if all iterations of the Batch state fail. For example, if you configure the Retry field in a Batch state with three iterations, the retry policy applies only if all three iterations fail.

Code View

In Code View, JSON details can be provided in fields collectionPath and collectionVariable. You can link a Function, Webhook, or Circuit using bind and define the number of threads for batch using degree.

Batch state example:

"Employee Onboarding Tasks": {
      "type": "batch",
      "next": "End",
      "start": true,
      "collection_path": "$.employee_list",
      "collection_variable": "employee",
      "degree": 10,
      "bind": {
          "type": "circuit",
          "circuit_id": "new_employee_onboarding"
      }
}







Next : Success state

    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






                          Quick Links Workflow Automation Data Collection
                          Web Forms Enterprise Begin Data Collection
                          Interactive Forms Workplace Data Collection App
                          Offline Forms Customer Service Accessible Forms
                          Digital Forms Marketing Forms for Small Business
                          HTML Forms Education Forms for Enterprise
                          Contact Forms E-commerce Forms for any business
                          Lead Generation Forms Healthcare Forms for Startups
                          Wordpress Forms Customer onboarding Order Forms for Small Business
                          No Code Forms Construction RSVP tool for holidays
                          Free Forms Travel Kiosk in mobile app
                          Prefill Forms Non-Profit

                          Intake Forms Legal

                          Form Designer HR

                          Card Forms Food
                          Assign Forms Photography

                          Translate Forms Real Estate
                          Electronic Forms

                          Notification Emails for Forms Alternatives
                          Holiday Forms Google Forms alternative 
                          Form to PDF Jotform alternative





                                            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

                                                                                                              • 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 instance, if you set a ...
                                                                                                              • 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, and in the event of failure, the entire process will have ...
                                                                                                              • Circuit

                                                                                                                Circuit enables you to create automated workflows for IT and business by organizing a sequence of tasks.. In certain cases, a process might include complex sub-processes that can be constructed as separate standalone circuits. These circuits can be ...
                                                                                                              • Execution logs

                                                                                                                A copy of all the executions that were tested is maintained in the circuit. You can access the execution history of a circuit anytime. This means you can select and re-run a specific execution at any time. To view the execution history of a circuit: ...
                                                                                                              • Create and configure a Circuit

                                                                                                                Create a Circuit Log in to Qntrl. Navigate to (settings) >> Automation >> select Circuit. Click Add New Circuit. Alternatively, you can also select New Circuit at the top-right corner of the home page. Specify a unique Name and add a Description for ...
                                                                                                                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