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 Add Function.
- Enter a name, choose the module type, select a language, and add a description, if needed.
- Click Save.
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
| ✗
| ✓
|
The in-built editor for Qntrl will now open. Write the function code from scratch and deploy it in the product.
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:
- Navigate to and select Functions under Advanced.
- Click New Function.
- Enter the following details:
- The name of your function. The name should not contain spaces or special characters. This will also be the display name of your function under Functions module.
- Choose the Module Type as Standalone from the drop-down.
- Select JavaScript language in which you can write the function code.
- Enter a description for your function.
- Click Save.
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:
- Navigate to and select Functions under Advanced.
- Click Add Function.
- Enter the following details:
- The name of your function. Make sure to write the name without spaces or special characters. This will also be the display name of your functions under Functions module.
- Choose the Module Type as Standalone from the drop-down.
- Select Python as the language and click Next.
- Enter a description for your function.
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:
- Navigate to and select Functions under Advanced.
- Click Add Function.
- Enter the following details:
- The name of your function. Make sure to write the name without spaces or special characters. This will also be the display name of your functions under the Functions module.
- Choose the Module Type as Standalone from the drop-down.
- Select Node JS as the and click Next.
- Enter a description for your function.
- Click Save.
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:
- Navigate to and select Functions under Advanced.
- Click Add Function.
- Enter the following details:
- The name of your function. The name cannot contain spaces or special characters. This will also be the display name of your functions under Functions module.
- Choose the Module Type as Standalone from the drop-down.
- Select the language as Java and click Next.
- Enter a description for your function.
- Click Save.
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:
- Navigate to and select Functions under Advanced.
- Click Add Function.
- Enter the following details:
- The name of your function. The name cannot contain spaces or special characters. This will also be the display name of your functions under the Functions module.
- Choose the Module Type as Cards from the drop-down.
- Zoho Deluge language will be chosen by default.
- Enter a description for your function.
- Click Save.
The built-in editor for Qntrl will now open. Write the function code to deploy it in the product.