CRUD Operations in CodeX Script Using ConfigStore | Online Help | Qntrl | ConfigStore

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

  1. Using Parameter Name: Requires both the parameter name and group name.

    • QntrlParam.ofName(paramName, paramGroupName)

  1. Using Parameter Link Name: Requires the parameter link name.

    • QntrlParam.ofLinkName(paramLinkName)

  1. Using Parameter ID: Requires the parameter ID.

    • QntrlParam.of(paramID)

 

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>");

 

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
param.destroy();



    • Related Articles

    • 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 ...
    • Qntrl 3.0: new updates and migration

      Latest additions and enhancements We recently released a new version of Qntrl: 3.0. This version has a fresh interface with simplified navigation and seamless performance. We’ve tried to incorporate as many feedback and suggestions as possible in our ...
    • Parameters in Circuit

      Parameters in Circuit allow you to use dynamic values in your automated workflows, making it easier to customize and control various parts of your process. These parameters are created in the ConfigStore and can be referenced throughout the different ...
    • Environment Scope for Parameters in Sandbox

      In the Sandbox module, you can assign dynamic values to parameters for different environments (e.g., development, testing, production), ensuring consistent configurations across multiple stages of the deployment process. These parameters can be ...
    • Scripts

      Early Access Scripts module is not enabled for all users. If you’d like to try it out, please email our support team for early access. Scripts module helps to simplify message execution for larger scripts. While simple commands can be executed ...

    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.