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"
}
}