Setting Up and Integrating Functions in Zoho Circuit | Functions | Zoho Circuit - Online Help

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 allocates the machine resources. Zoho Circuit enables you to write your code in Python, Node.js, Java, Go, or Zoho Deluge and run it seamlessly without caring about server management.

Set up functions in three steps:
  1. Create a function
  2. Integrate function to a circuit
  3. Test function integration

Create a Function 

To create a function:
  1. Log in to the Zoho Circuit console.
  2. Select Functions from the top menu, then click +New Function on the left. Alternatively, you can also select +Create New in the top-right corner of the homepage, then select Function.
  3. Specify a function Name. This name serves as an identifier that can be used to call the function. Enter a meaningful name without any spaces.
  4. In the dropdown beside Name, select the programming language you will use to write the function. 'Python' is selected by default. Zoho Circuit supports
    1. Python
    2. Java
    3. Node.js
    4. Go
    5. Zoho Deluge. 
  5. Add a Description for the function. Click Create. 

  6. Write your function script in the cloud IDE or editor displayed for the selected language. To learn more about writing functions, click here.

    A sample function for sending mass emails is displayed below. 

  7. Click Save in the top-left corner. 
  8. Select Execute, then specify the test input for executing your code. Click Execute again. 
  9. Click the Deploy button in the top-left corner. Functions must be deployed before integrating them to a Circuit.

Integrate a Function

To associate function with a Circuit:
  1. Log in to Zoho Circuits console
  2. Select Circuits from the top menu bar.
  3. Select the circuit you'd like to modify. Click the Edit icon [].
  4. In the displayed circuit, drag and drop the Function state from the Functional States pane on the left.

     
  5. Enter a unique name for the function state.
  6. Select the Previous State and Next State between which the new function state has to be added. Click Create.                                                
  7. Under Configuration on the right pane,  you can edit the state Name optionally.
  8. Type 'Function' is selected by default. Select the Function Name to be added to the circuit from the drop-down.
  9. The Next State selected during state creation will be displayed. If you'd like to change it, select a state from the dropdown.
    1. Specify the Error Handling options for the state. To learn more about Error Handling, click here.                                            


  10. Under Input / Output on the right, enter the Input Path, Output Path, and Result Path. To learn more about I/O paths, click here.
  11. In addition to the input JSON sent through the circuit to the function, you can define additional input parameters by clicking Add Parameters that will be specific to this circuit. Enter the parameter name and parameter value. These inputs will be passed to the function during execution.
  12. Click Save

Test your integration

To test your integration:
  1. After saving your circuit, click Test Run at the top.
  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. To learn more about Executions, click here.
  5. Check for the data received from the function.
  6. Modify your function settings if failure or data mismatch is encountered.
  7. Repeat this test until you get the required result using your function.
    • Related Articles

    • 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 ...
    • 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 ...
    • 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 ...

    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.