Parameters in CodeX Script
In the CodeX script, you can perform CRUD (Create, Read, Update, Delete) operations on the Parameters in Qntrl through the SDK. Instead of defining a URL or other values directly in your CodeX script, you can define them in ConfigStore and reference those values in CodeX using parameter names. This approach promotes re-usability and simplifies updates. Discover more about CodeX Script.
How to Use ConfigStore in CodeX Script
Define Parameters in ConfigStore: Create and store the required parameters, such as URLs or API keys.
Reference Parameters in Codex Script: Use parameter names or link names to refer to values stored in ConfigStore. For example, reference the api_url parameter in your CodeX script using {{api_url}}.
CRUD Operations: Use the SDK to perform Create, Read, Update, and Delete operations on parameters stored in ConfigStore directly from your codex script.
Methods to Call Parameters
Using Parameter Name: Requires both the parameter name and group name.
Using Parameter Link Name: Requires the parameter link name.
Using Parameter ID: Requires the parameter ID.
Example
// Instead of hardcoding the URL, reference it from ConfigStore let apiUrl = QntrlParam.ofLinkName("api_url"); // Use the referenced URL in your CodeX script let httpReq = new HttpRequest(); httpReq.url(apiUrl); httpReq.method("GET"); httpReq.headers("{ 'Content-Type': 'application/json' } "); let httpRes = httpReq.execute();
|
CRUD Operations in CodeX
Create Parameter
To create a parameter, the name and value are mandatory. If the group is not specified, it defaults to 'none'. If the scope is not given, it defaults to 'global'. The encrypted parameter defaults to false.
Syntax
QntrlParam.create("<param name>", "<group name>", true/false, QntrlParam.Scope.<GLOBAL/ENV>, "<param value>", "<default value>"); |
Read Parameter
You can retrieve parameter details using the parameter name, link name, or ID. This allows you to get all the parameter details, such as name, ID, scope, etc.
Get Parameter by Name
Syntax
var param = QntrlParam.ofName("<param name>", "<group name>"); |

When retrieving a parameter by name, you must specify the group name. If the group name is not provided, it defaults to the default group. If the parameter is not found in the specified group, an error will be thrown.
Get Parameter by ID
Syntax
var param = QntrlParam.of("<param ID>"); |
Get Parameter by Link Name
Syntax
var param = QntrlParam.ofLinkName("<link name>"); |
Update Parameter
Syntax
param.update("<param name>", "<param value>", false, QntrlParam.Scope.<scope>, "<default value>"); |
Delete Parameter
Syntax
Related Articles
Script Modules
Script Modules offers creating reusable, ready-made templates for your business logic compatible with ES6 modules. When you need that specific logic in another script, you don't have to write or copy-paste the code again. You can easily include the ...
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. Add a Script To add a new script, follow the below steps: Navigate to ...
Parameters
Parameters provide the ability to customize JSON input by adding a collection of key-value pairs as input to a task. These values can either be static or dynamically selected from the JSON input or the context object using specific paths. Context ...
Server Variables
Server Variable is a feature for storing values, such as text, numbers, email addresses, or any other data, and reusing values across your scripts, making your scripts more efficient and easier to manage. If you need to update these values, you can ...
Function
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 ...
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.