Managing CodeX Scripts in Qntrl: Add, Edit, Trigger, and Organize Execution | Qntrl Online Help

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 steps:
  1. Navigate to (settings) >> CodeX >> click Scripts in the menu.
  2. Click the New Script button.
  3. Code the script according to your business requirements.
  4. Provide the following execution details:
    1. Script Name: Enter a name for your server script.
    2. Execution Location: Select the location where the script should run.
    3. Execution Trigger: Specify when the script should be executed.
    4. Board: Choose the board for which the script will be executed.
  1. Click the Publish button and confirm your action. You also have the option to save it as a draft and publish it later by clicking Save as Draft. 

                   

 

A new script will be added to Codex in Qntrl.
NotesAn execution trigger can only be used twice for a particular board.

Parameter Configuration Limits

The default JavaScript configuration will be as follows:

config: {

      cpu_timeout: 1000

      cpu_memory: 50

      file_request_count: 10

      file_size: 100

      http_clientrequest_count: 10

      sdk_call_count: 100

      logger_level: "INFO"

      execution_timeout: 30000

      execution_log_limit: 30000

}
Units for the a above are in 'ms' and 'MB'.

Info

Advanced Options (Enterprise Only)

Advanced Options are available exclusively to enterprise customers and are enabled on requestThese options allow enterprise users to fine-tune deployment behavior by configuring the following thresholds.

If you're not an enterprise user, your deployments will adhere to the default system limits.

Parameter Name

Description

Range/Allowed Values

Cpu Time (ms)

Maximum CPU time allocated for the function's execution

100 - 240000

 

Memory (MB)

 

Memory limit allocated for the function's execution

5 - 4000

 

File Request Count

 

Number of files that can be created

 

1 - 2000

Maximum File size (MB)

Maximum size per file

1 - 8000

HTTP Client Request Count

Number of external HTTP requests allowed

1 - 8000

SDK Call Count

Number of internal SDK calls allowed

1 - 8000

Execution Timeout (ms)

 

Maximum time allocated for the function's execution

500 - 3600000

Execution Log Limit

 

Maximum number of character logs to be stored in zlogs

3000 - 20,00,000 characters

 

Logger Level

 

Logging level of the function

FATAL, ERROR, WARN, INFO, DEBUG, TRACE

 


Managing CodeX Scripts

Edit a Script 

To make changes to a script in CodeX, follow these steps:
  1. Navigate to (settings) >> CodeX >> click Scripts in the menu.
  2. Select the codex script you wish to edit.
  3. Make the necessary modifications.
  4. Click the Publish button and confirm your changes.
The codex script will be updated.
Notes
Publish your scripts so that the updated versions can be executed effectively.

 


Set Execution Order for CodeX Scripts    

You can decide the order in which the codex gets executed. To set the execution order:

  1. Navigate to (settings) >> CodeX >> select Scripts in the menu.

  2. Click the Set Execution Order button at the top right of the page.

       

  1. Choose a Form for script execution and select the Execution Trigger for when it should be activated.

  2. A list of scripts will be displayed based on your selections.

  3. In the EXECUTION ORDER section arrange the scripts in the desired execution order.

  4. Click Save.

The scripts will be executed according to the order set.
 

Filter Scripts   

You can filter codex to categorize them based on forms. To filter the codex for a specific form:
  1. Navigate to (settings) >> CodeX >> select Scripts in the menu.
  2. Click on in the All Forms column and select a form from the displayed list.       


Scripts of that particular form will be displayed.

 

Enable or Disable Scripts   

All the published codex scripts are enabled by default. Disabling a server script will temporarily stop its execution.
1. Navigate to (settings) >> CodeX >> select Scripts in the menu.
2. Under the Active column, toggle the button next to a server script to activate or deactivate the script.

 



Delete a Script 

To delete a codex script:
1. Navigate to (settings) >> CodeX >> select Scripts in the menu.
2. Hover over the name of the script you want to delete, click mouse over action menu, , and select Delete.
3. Confirm your delete action.

 


Triggering Script Execution: Locations and Triggers

CodeX scripts can be activated from various modules within Qntrl. The functionality and behavior of the scripts vary depending on the module.
Info
  • Free users: Scripts can be triggered only from the Cards module.
  • Enterprise users: Can access multiple execution locations and advanced triggers.

Below are the supported modules where CodeX scripts can be executed, along with their available triggers:   

Cards

  1. On Load - This script runs when a form is first loaded in the Qntrl system as part of the page rendering process. It can be used to initialize variables, retrieve data, set default values, or apply dynamic behaviour to the user interface. 
  2. Before Create - Script runs just before a new record is created. It allows developers to validate input data, set default values, or run custom logic before the record is officially added to the system.
  3. After Create - Executed after a new record is successfully created, this trigger is used for post-creation tasks like sending notifications, updating related records, or executing additional logic.
  4. Before Update - This trigger runs before an existing record is updated. Developers can use it to validate or manipulate data before the changes are applied.
  5. After Update - The script is triggered after a record is updated, allowing developers to perform actions or updates that should follow the modification of the record.
  6. Before Delete - Script runs just before a record is deleted from the Ql system. It can be used for validation, cascading deletions, or any necessary logic before the record is permanently removed.
  7. After Delete - Executed after a record is successfully deleted, this trigger is used to perform post-deletion tasks such as updating related records, logging events, or running any required custom logic.

 

Email In 

When an email is sent to Qntrl, a new card is automatically created. By adding codex scripts you can customize this process by assigning values to custom fields, creating sub-cards, etc during card creation. These scripts analyze incoming email data and execute actions upon card creation.
 

Transition 

CodeX scripts can be triggered at different stages of a transition process:
  1. Before Transition: Executed just before the transition starts.
  2. During Transition: Runs while the transition is in progress.
  3. After Transition: Triggered once the transition has completed.

 

Circuits 

CodeX scripts can be executed through functions defined in the system.


 

Scheduler 

Scripts can also be triggered based on scheduled tasks, allowing for automated execution at predefined intervals.


    • Related Articles

    • 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 ...
    • 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 ...
    • Step 1: Create Form

      Forms are used to capture requests from users that help you collect the data required to kickstart workflows and perform tasks in Qntrl. There are different departments in an organization providing different solutions. For instance, the finance team ...
    • Summary

      Overview CodeX, a robust scripting feature within the Qntrl platform, empowers you to automate tasks, manipulate data, and integrate workflows/applications. By running JavaScript code in a standalone server environment, CodeX allows you to execute ...

    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.