Functions | Online Help | Qntrl

Functions

Alert
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:
  1. Zoho Deluge
  2. JavaScript
  3. Python
  4. Node JS
  5. Java

Business uses cases

  1. Write a Java function that allows you to create a Qntrl card or send an SMS to a contact listed on a Qntrl card
  2. Create a Python function in Qntrl that can validate an email address or determine the strength of a password
  3. Write a Node JS function in Qntrl to hide passwords with asterisks (***) when entered or retrieve the current date and time   

Create a function 

  1. Navigate to and select Functions under Advanced.
  2. Click New Function from the top right corner of the page. 
  3. Enter the following details:
    1. 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. 
    2. Module Type: Choose the appropriate module type. For more information, refer the Module Type section.
    3. 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.
    4. 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.
    5. Description: Add a description for the function.
  4. 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.
Info
  1. 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.  
  2. 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: 
Info
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
   }

Notes
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:
  1. Follow the instructions in Create a Function section to set up the function, and then select "Python" as the programming language
  2. The in-built editor for Qntrl will now open.
  3. Write the function code from scratch and deploy it in the product.
  4. Click Save & Execute to run your code.
  5. When there are no errors in the code, the Input values dialog box opens.
  6. 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.
  7. 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.
  1. config.json is a configuration file
  2. 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:
  1. path: The .js file path that contains the function code.
  2. action: Contains the action that your code performs. This is also the name of the main class in your .js file.
  3. 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:
  1. Follow the instructions in Create a Function section to set up the function, and then select "Node JS" as the programming language. 
  2. The built-in editor for Qntrl will now open. Write the function code from scratch and deploy it in the product.
  3. Click Save & Execute to run your code.
  4. 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.
  1. config.json is a configuration file
  2. 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:
  1. path: The .js file path contains the function code.
  2. action: Contains the action that your code performs. This is also the name of the main class in your .js file.
  3. 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:
  1. Follow the instructions in Create a Function section to set up the function, and then select "Java" as the programming language. 
  2. The built-in editor for Qntrl will open. Write the function code and deploy it in the product.
  3. Click Save & Execute to run your code.
  4. When there are no errors in the code, the Input values dialog box will open.
  5. 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.
  6. 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:
  1. Output key with a value which is the output data
  2. 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.
  1. config.json is a configuration file
  2. lib is the library to which you can upload your third-party packages. Right-click the folder to upload files.

 
Notes
  1. Jar files and packages can only be uploaded to the library
  2. 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.
Notes
  1. You can upload only one zip file per function.
  2. 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:
  1. Follow the instructions in Create a Function section to set up the function, and then select "Java" as the programming language. 
  2. The built-in editor for Qntrl will now open.
  3. Write the function code to deploy it in the product.


    • Related Articles

    • Manage Custom Functions

      Custom functions allow users to develop and execute user-defined functions using Deluge. You can execute simple program snippets to automate processes, or integrate with third-party or Zoho applications. Business Uses for Custom Functions Use Custom ...
    • Configure Schedules

      Qntrl allows users to trigger custom functions periodically or at defined time intervals using Schedules. It can be used to obtain automated updates, weekly notifications, or monthly reports in an organization. Business Scenarios Schedule recurring ...
    • Custom Function: Move_Job_to_other_Stage

      This custom function can be used to move a card to any stage in the blueprint automatically. Cards can be moved to previous stages or upcoming stages. Business Scenario Mark, the head of Marketing, reviews all the marketing articles in his ...
    • REST API

      Access Privilege API key can be generated only by the Organization Owner. An API key provides a one-time authentication for triggering API calls in Qntrl. Only the standalone custom functions can be invoked using the API key. Navigate to and select ...
    • Other actions in Projects

      Free up a sandbox You can unassociate a project from the sandbox when you want to free up a sandbox. To unassociate a sandbox: Navigate to and select Projects under Advanced. Click the Sandbox button at the top band. All sandboxes will be listed ...

    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.