A Function is a serverless, simple programming script that can handle a variety of tasks and integrate with other tools to create robust automated workflows. You can write Functions in Python, Node.js, Java, and Zoho Deluge, and perform seamless execution with Circuit without worrying about server management.
Prerequisite
Create a standalone function in Qntrl. Functions must be deployed before integrating them into the Circuit. Click here to learn how to create and deploy a function.
Example Use Case: One of the main steps during employee onboarding involves identifying and allocating the required assets, as well as installing the operating system (OS) and necessary software on designated computers. In this 'Asset Allocation' process, the Function state can be employed to invoke a custom function, which in turn would retrieve the license key from the vault and apply it during the installation of the OS or software. Refer to the 'Employee Asset Allocation' circuit in the figure below, which has been configured specifically for the task of allocating assets to employees and is nested within the employee onboarding process.
Builder View
In Builder View, to incorporate a function into a circuit:
Drag and drop the Function state from the left pane into your circuit or click the required Function state in your circuit.
Under Configuration, update the common state field attributes.
Type Function is selected by default. Select the Function Name to be added to the circuit from the drop-down list.
Specify the Error Handling options for the state. Learn more about Error Handling.

Under Input / Output on the right pane, you can optionally fill in the following details:

6. Click Save and Execute at the bottom of the page.
-
Specify the test data as Input JSON for your test run, then click Next.
-
Name your test run for this execution. Click Run.
-
Check for the data received from the function.
-
Modify your function settings if failure or data mismatch is encountered.
-
Repeat this test until you get the required result using your function.
Code View
In Code View, the JSON to incorporate a function into a circuit is given below:
"Licence Key Activation": {
"type": "function",
"next": "End",
"function_id": "function_licence_activation_21",
"parameters": {
"software_name": "$.software.name",
"software_version": "$.software.version"
}
}
Related Articles
Circuit
The Circuit state allows you to nest an existing, pre-configured circuit within another workflow. This is useful when your process includes complex sub-processes that are best managed as standalone circuits. Instead of rebuilding the same logic, you ...
Create and Configure a CodeX Script
Prerequisite Prior to creating a codex, it is essential to establish a board since the configured codex scripts can be activated within that Board when specific conditions arise. Create and Configure a Script To add a new script, follow the below ...
Script Modules
Early Access Script module is not enabled for all users. If you’d like to try it out, please email our support team for early access. Script Modules offers creating reusable, ready-made templates for your business logic compatible with ES6 modules. ...
Custom Function: Create_Job
This custom function can be used to create a new card in any board. It can also be configured to carry forward necessary field values from the former card to the latter. Business Scenario Helen is the head of Procurement Management in her ...
SSH Engine
SSH Engine state is configured to connect to a client's machine or network and remotely execute commands or scripts on the client's Linux/UNIX operating system. Prerequisite Bridge must be installed and should be active. Learn how to install and ...