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.  
  

Add 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. 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. Form: Choose the form for which the script will be executed.
    5. Advanced Options: Advanced Options enables you to configure the following restrictions:
      • Memory in MB
      • File Request Count
      • Http Client Request Count
      • Maximum File Size in MB
      • SDK Call Count
      • Logger level
      • Execution timeout in ms
      • Execution logs limit in characters
  1. Code the script according to your business requirements.
  2. 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 form.

 

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: Supported Modules

CodeX scripts can be activated from various modules within Qntrl. The functionality and behavior of the scripts vary depending on the module. Below are the supported modules where the scripts can be triggered:
  • Jobs
  • Email in(card creation)
  • Transition(Before, During, After)
  • Circuit(via Function)
  • Scheduler(via Function)

   

Jobs

CodeX scripts are executed based on specific triggers, which define when the script should run. Below are the available execution triggers for Jobs:
  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:
Before Transition: Executed just before the transition starts.
During Transition: Runs while the transition is in progress.
After Transition: Triggered once the transition has completed.

 

Circuit 

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

      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 ...
    • 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 ...
    • 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 ...
    • 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 ...

    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.