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
(settings) >> CodeX >> click Scripts in the menu. Click the New Script button.
Provide the following execution details:
Script Name: Enter a name for your server script.
Execution Location: Select the location where the script should run.
Execution Trigger: Specify when the script should be executed.
Form: Choose the form for which the script will be executed.
Advanced Options: Advanced Options enables you to configure the following restrictions:
Code the script according to your business requirements.
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.
![](https://help.qntrl.com/galleryDocuments/edbsn97df1db50f2cc7bdf6e46c4b81f9dd15c6da24ca27de25a41c00e226f3ec1279bc717e47d9b074d5254b34457d2f46cf?inline=true)
A new script will be added to Codex in Qntrl.
An 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:
Navigate to
(settings) >> CodeX >> click Scripts in the menu. Select the codex script you wish to edit.
Make the necessary modifications.
Click the Publish button and confirm your changes.
The codex script will be updated.
![Notes](https://static.zohocdn.com/zoho-desk-editor/static/images/file.png/)
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:
Navigate to
(settings) >> CodeX >> select Scripts in the menu. Click the Set Execution Order button at the top right of the page.![](https://help.qntrl.com/galleryDocuments/edbsn72ef2b3097e003a28b3e25f1a15de86bfcf84ffd8eb3c888fa6cd35f3f63e48434442017a958b9d6307f178e50ba7719?inline=true)
Choose a Form for script execution and select the Execution Trigger for when it should be activated.
A list of scripts will be displayed based on your selections.
In the EXECUTION ORDER section arrange the scripts in the desired execution order.
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:
Navigate to
(settings) >> CodeX >> select Scripts in the menu. Click on
in the All Forms column and select a form from the displayed list.
![](https://help.qntrl.com/galleryDocuments/edbsnb5c393e11eb2db205f402b594cbe0eb1f932310927a1541d147683c171d37e144ea8e8d88ee7b6fccf3099bb2fa48151?inline=true)
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.
![](https://help.qntrl.com/galleryDocuments/edbsn04ec2e65b9459571fd8d8f06c737ef4109b6c365f073d9cd54a32340dd1f9ba76d3e4e17e7eef5c5b3f759e54627b919?inline=true)
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
CodeX scripts are executed based on specific triggers, which define when the script should run. Below are the available execution triggers for Jobs:
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.
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.
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.
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.
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.
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.
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.