CodeX Scripts allows users to define custom logic that runs automatically based on events in the modules such as when a project or task is created, updated, or deleted. These scripts help enforce validations, restrict actions, or apply conditions that align with your business requirements.
CodeX Scripts are currently available as a limited release. To enable this feature for your portal, please contact support@zohoprojects.com
CodeX Scripts work on monthly
CodeX credits. The number of credits available depends on your subscription plan.
Plan | Monthly CodeX Credits
|
Free
| 50
|
Premium
| 500
|
Enterprise
| 50000
|
Ultimate
| 500000
|
- Each script execution uses 1 CodeX credit.
- Credits reset automatically every month, and the reset date adjusts according to your portal’s timezone.
- Unused credits do not carry forward to the next month.
Understanding Codex Scripts
Current Object in CodeX Scripts
When writing CodeX Scripts, you will often work with the "current" object. This
object represents the context in which the script is triggered, such as a task or project.
Example: current.record - Refers to the record being executed on (e.g., the task or project).
Typing current. in the editor will display all supported objects and properties available in the script environment.
Built-in Methods
Example: client.save(record) - Saves the updated record.
Typing client. in the editor will display all supported methods and properties available in the script environment.
These are JavaScript SDKs made available in this scripting environment to help you interact with live data.
Understanding the Editor
The CodeX Script editor provides a code-friendly interface for writing and managing the scripts. The key tools in the editor toolbar can be used to:
Font Size : Adjust the font size for better readability.

: Reverts your last change.

: Restores a previously undone action.

: Cuts selected code.

: Copies and pastes the selected code in the next line.

: Aligns code to the left.

: Aligns code to the right.

: Adds selected code as a comment in the script.

: Removes the selected code from the script.

: Search and replace text or code.

: Wraps the code in the next line.

: Automatically formats the code at once for better readability.

: Formats the code when coding.

: View all available keyboard shortcuts.

: Opens help resources.

: Switches between light and dark editor themes.
Create a Variable
Variables are reusable values that can be referenced in your CodeX Scripts.
For example, you might want to define a specific client name or task owner ID that your script checks against. Instead of writing the value directly into every script, you can create a variable and use it across the scripts.
- Click
in the top-right corner.
- Navigate to Developer Space > CodeX Scripts.
- Click Variables in the top-right corner.
- Click Create Variable.
- Enter the name and choose the scope:
- Select Global to use it across all scripts.
- Select Script to restrict usage to a specific script, then choose the script and enter the value.
- Click Save.
To use a variable in your CodeX Script:
- If the variable name follows JavaScript variable naming rules:
variables.<var_name>.value - For other names (with spaces, special characters, etc.):
variables["<var_name>"].value
or
variables['<var_name>'].value
Example:
If the variable is named closed_status_id, you can use variables.closed_status_id.value in the script.
Create a CodeX Script
Create CodeX Scripts to add validations or business specific conditions to your projects or tasks in Zoho Projects. For example, if you want to prevent task updates in archived projects, you can write a CodeX Script that checks if a project is archived and stops users from editing its tasks.
- Click
in the top-right corner.
- Navigate to Developer Space > CodeX Scripts.
- Click Create CodeX Scripts in the top-right corner.
- Enter the CodeX Script Name.
- Select the Module, Layout, and the Event.
- Write the script with logic in the editor.
- Use current. to explore supported objects and properties.
- Use client. to explore supported methods to perform actions.
- Click Save to save it or Save and Close to save it and return to the Codex Scripts list.
You can also use code from existing
examples.
Limitations:
Script Limits
Limitation Type | Maximum Allowed |
Before-event scripts per module, layout, and action | 3 |
After-event scripts per module, layout, and action | 5 |
Variables per script | 50 |
Global variables per portal | 100
|
Execution Limits
Each CodeX Script runs with certain limitations depending on whether it executes before or after an event, such as creating or updating a task or project.
Action Type
| Before Event
| After Event
|
Timeout- The maximum time the script is allowed to run.
| 3 seconds
| 10 seconds
|
SDK Calls -The number of times the script can interact with Zoho Projects data (for example: fetching records, updating fields).
| 5
| 10
|
HTTP Requests- The number of times the script can connect to external services or apps.
| 3
| 5
|
Manage CodeX Scripts
Edit CodeX Script
- Click
in the top-right corner.
- Navigate to Developer Space > CodeX Scripts.
- Click the CodeX Script you wish to edit.
- Make necessary changes and click Save.
Module cannot be edited once the CodeX Script is saved.
Enable CodeX Script
- Click
in the top-right corner.
- Navigate to Developer Space > CodeX Scripts.
- Toggle on the status to enable the CodeX Script.
- To disable it, toggle off the status.
Reorder CodeX Script
Reorder codeX Scripts to change the order of the execution.
- Click
in the top-right corner.
- Navigate to Developer Space > CodeX Scripts.
- Hover over the CodeX Script, click and hold the reorder icon, drag and drop it above or below to reorder it.
Script Execution Order
When multiple CodeX Scripts are configured for the same module, layout, and event, the execution order is determined by the position of the scripts in the list.
Scripts are evaluated from top to bottom. For each event type, CodeX Scripts follow these limits:
- Up to 3 Before-event scripts
- Up to 5 After-event scripts
If the number of enabled scripts is within these limits, all scripts are executed in the listed order.
If the number exceeds the limit, only the scripts that appear within the allowed count from the top are executed, and the remaining scripts are skipped.
Scripts created for All Layouts and specific layouts are evaluated together, and ordering applies across both.
Maintaining the correct order ensures that the intended scripts are executed and prevents important logic from being skipped.
Filter CodeX Scripts
You can use filters to find specific CodeX Scripts based on their configuration or status.
- Click
in the top-right corner.
- Navigate to Developer Space > CodeX Scripts.
- Click the Filter icon in the top-right corner of the script list.
- Choose one or more filter criteria from the list.
- Choose Any of these or All of these to define how filters should be applied.
- Click Find to apply the filter.
View Execution Logs
- Click
in the top-right corner.
- Navigate to Developer Space > CodeX Scripts.
- Click
in the top-right corner.
- Select Logs to view the execution logs.
- Click the script to view respective logs.
Only up to 30,000 characters of logs can be stored per script execution. Any logs generated beyond this limit will not be recorded.
Delete CodeX Script
- Click
in the top-right corner.
- Navigate to Developer Space > CodeX Scripts.
- Hover over the CodeX Script, click
> Delete.
- Confirm your action.
More Reads