Early Access
Functions are not enabled for all users. If you have enabled Circuit in your organization, all your custom functions will be migrated as functions. If you’d like to try out Circuit, please
email our support team for early access.
Functions allow users to program a set of operations and execute them when invoked from an application. Users can automate processes or integrate with Zoho and other third- party applications using Functions.
Functions in Qntrl allows you to write your own scripts in a language that you are comfortable with. Qntrl's Functions are serverless, where the cloud provider allocates machine resources dynamically. You can write your code in Qntrl without having to worry about server management while running the code.
Below are the programming languages that are supported by Functions:
- Zoho Deluge
- JavaScript
- Python
- Node JS
- Java
Business uses cases
- Write a Java function that allows you to create a Qntrl card or send an SMS to a contact listed on a Qntrl card
- Create a Python function in Qntrl that can validate an email address or determine the strength of a password
- Write a Node JS function in Qntrl to hide passwords with asterisks (***) when entered or retrieve the current date and time
Create a function
Navigate to and select
Functions under Advanced. Click New Function from the top right corner of the page.
Enter the following details:
Name: Enter a unique name for the function without without spaces or special characters. This name will serve as an identifier when invoking the function.
Module Type: Choose the appropriate module type. For more information, refer the Module Type section. Boards: If you select 'Boards' as the module type, choose a board from the dropdown list. For 'Standalone' modules, the Boards section will be disabled.
Language: Select the programming language for writing the function from the dropdown. By default, 'Zoho Deluge' is pre-selected. Only Deluge is available for the 'Cards' module type.
Description: Add a description for the function.
Click Save.
The in-built editor for Qntrl will now open. Write the function code from scratch and deploy it in the product.
Module Type
Cards: Select the Module type as Cards to invoke the field details of your card in the code to perform the business logic. You'll be able to choose the field that needs to be passed as an argument in the function.
Standalone: Select the Module type as Standalone if you would like to pass the arguments in the function manually.
- Module Type by default is chosen as Cards. If the function requires card arguments, then the programming language must be Zoho Deluge. Other supported languages will not be listed.
- When you choose the Module Type as Standalone, you will have the option to write your scripts in multiple languages.
The following table outlines the supported module type based on the language chosen:
LANGUAGE
| SUPPORTED MODULE TYPE
|
| Cards
| Standalone
|
Zoho Deluge
| ✓
| ✓ |
JavaScript
| ✗
| ✓
|
Python | ✗
| ✓
|
Node JS | ✗
| ✓
|
Java
| ✗
| ✓
|
JavaScript
Write your functions in JavaScript and associate them with workflows, business rules, schedules, orchestrations, circuits, or have them as standalone functions. Function scripts can be written in Qntrl's editor.
To create a new JavaScript function, follow the instructions in Create a Function section to set up the function, and then select "JavaScript" as the programming language. Built-in editor for Qntrl opens. Write the function code from scratch and deploy it in the product.
JavaScript configurations can be defined using a few additional parameters. To set up these, click on the Request Parameters pop-up on the right-side of the screen.
Parameter Name
| Description
| Range/Allowed Values
|
cpu_timeout
| Maximum time allocated for the function's execution.
| 1-10 seconds
|
cpu_memory
| Memory limit allocated for the function's execution.
| 50-500 MB
|
file_size
| Maximum file size that can be handled by the function.
| 100-1000 MB
|
inbound_count
| Count of the function's inbound operations.
| 100-500
|
outbound_count
| Count of the function's outbound operations.
| 10-1000
|
file_operation_count
| Number of file operations the function can perform.
| 10-100
|
logger_type
| Logging level of the function.
| FATAL, ERROR, WARN, INFO, DEBUG, TRACE
|
execution_timeout
| Maximum time allocated for the function's execution.
| 10 seconds-3 minutes
|
execution_log_limit
| Maximum number of character logs to be stored in zlogs.
| 30,000-2,00,000 characters
|
The default JavaScript configuration will be as follows:
config: {
cpu_timeout: 5000
cpu_memory: 10
file_size: 100
inbound_count: 100
outbound_count:10
file_operation_count: 10
logger_type: "INFO"
execution_timeout: 30000
execution_log_limit: 30000
}
Units for the above are in 'ms' and 'MB'.
Once your function is ready and the parameters are configured, click Save & Execute to run your code. If there are no errors in the code, the Input values dialog box opens.
Specify the arguments based on which your function executes and click Execute. The Execution Status dialog box displays the Output and Log.
Sample JavaScript to create a folder and upload a file
This function will create a folder and upload a file to that folder. Once you execute this function, you will be prompted to give the input details.
On successful execution, a success message will be displayed and the file will be uploaded to the newly created folder. If the execution is unsuccessful, an error message will be displayed.
Python
Write your functions in Python and associate them with workflows, business rules, schedules, orchestrations, or have them as standalone functions. Code your scripts in Qntrl's editor.
To create a new Python function:
- Follow the instructions in Create a Function section to set up the function, and then select "Python" as the programming language
- The in-built editor for Qntrl will now open.
- Write the function code from scratch and deploy it in the product.
- Click Save & Execute to run your code.
- When there are no errors in the code, the Input values dialog box opens.
- Whenever a function is executed, there will be some values passed with the function. These values are called arguments. Specify the arguments based on which your function runs.
- Click Execute.
Sample Python script to check password strength
The input body must be a JSON object with values for the arguments used in the code.
Pack your function
Qntrl automatically packages your Python function and creates config.json and library files.
In the left panel, you can view the config.json and lib files.
- config.json is a configuration file
- lib is the library to which you can upload your third-party packages. Right-click the folder to upload files.
Specify the values of the following keys:
- path: The .js file path that contains the function code.
- action: Contains the action that your code performs. This is also the name of the main class in your .js file.
- connector: Contains the name of the connection that your function calls, if any.
Use the code below to pass the arguments of your function in the body.
The input body must be a JSON object with values for the arguments used in the code.
Node JS
Write your functions in Node JS and associate them with workflows, business rules, schedules, or orchestrations, or have them as standalone functions.
To create a new Node JS function:
- Follow the instructions in Create a Function section to set up the function, and then select "Node JS" as the programming language.
- The built-in editor for Qntrl will now open. Write the function code from scratch and deploy it in the product.
- Click Save & Execute to run your code.
- When there are no errors in the code, the Input values dialog box opens.
Sample Node JS script to find the stock price
Pack your function
Qntrl automatically packages your Node JS function and creates config.json and library files.
In the left panel, you can view the config.json and lib files.
- config.json is a configuration file
- lib is the library to which you can upload your third-party packages. Right-click on the folder to upload files.
Specify the values of the following keys:
- path: The .js file path contains the function code.
- action: Contains the action that your code performs. This is also the name of the main class in your .js file.
- connector: Contains the name of the connection that your function calls, if any.
Use the code below to pass the arguments of your function in the body.
The input body must be a JSON object with values for the arguments used in the code.
Java
Code your functions in Java and associate them with workflows, business rules, schedules, orchestrations, circuits, or have them as standalone functions. Function scripts can be written in Qntrl's editor.
To create a new Java function:
- Follow the instructions in Create a Function section to set up the function, and then select "Java" as the programming language.
- The built-in editor for Qntrl will open. Write the function code and deploy it in the product.
- Click Save & Execute to run your code.
- When there are no errors in the code, the Input values dialog box will open.
- Whenever a function is executed, there will be some values passed with the function. These values are called arguments. Specify the arguments based on which your function runs.
- Click Execute.
Sample Java script to send SMS
Output
The function executes and renders an Output in the Execution successful dialog box.
This output will have two keys:
- Output key with a value which is the output data
- Log key has log data which the user prints using statement
Pack your function
Qntrl automatically packages your Java function and creates config.json and library files.
You can view the config.json and library files in the left panel.
- config.json is a configuration file
- lib is the library to which you can upload your third-party packages. Right-click the folder to upload files.
- Jar files and packages can only be uploaded to the library
- Files up to 10 MB are only allowed
To pass the arguments of your function in the body, use the below code.
The input body must contain JSON object with the values of the arguments used in the code.
The function executes and displays the response in the console.
- You can upload only one zip file per function.
- The maximum allowed size of the zip file is 10MB.
Zoho Deluge
Write your functions in Zoho Deluge and associate them with circuits, workflows, business rules, schedules, orchestrations, or have them as standalone functions.
To create a new Deluge function:
- Follow the instructions in Create a Function section to set up the function, and then select "Java" as the programming language.
- The built-in editor for Qntrl will now open.
- Write the function code to deploy it in the product.