Codex Scripts in Zoho Projects allow users to customize how the projects and tasks operate. Using these scripts, users can automate validations and actions, integrate external systems, and retrieve or update the data.
CodeX Scripts are currently available as a limited release. To enable this feature for your portal, please contact support@zohoprojects.com
Codex Scripts give access to objects that hold key details such as current records, fields, and metadata where the script is executed. The "Current" object holds contextual information about the record or environment where the script runs.
Object
current { record, affectedFields, action, org, user, module }
Params:
Name | Description
|
| Current record which is being executed. |
affectedFields | Fields that are updated in the current action. |
action | Represents the action being performed, e.g., BEFORE_UPDATE, AFTER_CREATE. |
org | Org-specific data. |
user | The current user performing the action. |
module | The module data (Task, Project) related to the record. |
Client SDK Methods
Codex Scripts also provide several client-side methods (actions users can perform) to interact with Zoho Projects data. The below client-side SDK methods interact with records, users, layouts, modules, etc from Zoho Projects portal.
Save Records
client.save(record) - Save or update a record such as task or project, in the Zoho Projects portal. This method automatically determines whether to create or update the record based on the record ID.
- If the record contains an id, the existing record is updated.
- If the record does not contain an id, a new record is created for that entity.
Params:
Name | Description |
record | Enter the record to save. E.g. Task, Project. |
- {
- "id":"175513000000135011",
- "layoutId":"175513000000027008",
- "projectId":"175513000000135011",
- "moduleId":"175513000000027005",
- "end_date":"2025-12-15",
- "hourly_budget":"500.000",
- "revenue_budget":"15000.000",
- "billing_method":"2",
- "is_public_project":false,
- "description":"<div>Revamp of Zylker's client portal.</div>",
- "is_strict_project":true,
- "cost_per_hour":"500.000",
- "currency":"INR",
- "tracking_method":"1",
- "budget_type":"5",
- "start_date":"2025-08-01",
- "owner":"175513000000060003",
- "project_type":"active",
- "created_time":"1726215358660",
- "is_rollup_project":false,
- "created_by":"175513000000060003",
- "cost_budget":"10000.000",
- "percent_complete":"17",
- "rate_per_hour":"1000.000",
- "last_updated_time":"1749370606429",
- "completed_time":null,
- "name":"Zylker Website Revamp",
- "updated_by":"175513000000060004",
- "project_group":"175513000000025001",
- "fixed_cost":"0.000",
- "status":"175513000000027104"
- }
Retrieve Record by ID
client.getRecordById(moduleId, id) - Retrieve a record from the Zoho Projects portal using its ID.
Params:
Name | Description |
moduleId | Enter the ID of the current module being executed. |
id | Enter the record ID. |
- {
- "id": "214815000000120442",
- "layoutId": "214815000000111729",
- "projectId": "214815000000120442",
- "moduleId": "214815000000027005",
- "end_date": "1755196800000",
- "hourly_budget": "120.000",
- "revenue_budget": "85000.000",
- "billing_method": "4",
- "cf_decimal": "7.50",
- "is_public_project": false,
- "cf_number": "456",
- "description": "Mobile app development for Zylker Retail.",
- "is_strict_project": true,
- "cf_email": "monica.hemsworth@zylker.com",
- "cost_per_hour": "75.000",
- "cf_multi_line": "API integration pending <br> \\n Client approval required",
- "cf_currency": "820.5000",
- "currency": "USD",
- "tracking_method": "1",
- "cf_multi_user_picklist": [
- "214815000000117285"
- ],
- "budget_type": "2",
- "start_date": "1754524800000",
- "owner": "214815000000117285",
- "project_type": "active",
- "created_time": "1753082475000",
- "cf_pick_list": "214815000000111779",
- "is_rollup_project": false,
- "cf_url": "https://projects.zylker.com/resource-hub",
- "cf_checkbox": true,
- "created_by": "214815000000068003",
- "cost_budget": "60000.000",
- "percent_complete": "25",
- "cf_single_line": "Initial phase completed",
- "cf_user_pick_list": null,
- "rate_per_hour": "110.000",
- "cost_budget_threshold": "50000.000",
- "cf_phone": "9876543210",
- "hourly_budget_threshold": "90.000",
- "cf_percentage": "0.85",
- "last_updated_time": "1755738857000",
- "completed_time": null,
- "name": "Zylker Mobile App Dev",
- "updated_by": "214815000000068003",
- "project_group": "214815000000118849",
- "fixed_cost": "10000.000",
- "cf_multi_select": null,
- "cf_date_field": "1754611200000",
- "status": "214815000000027092"
- }
Retrieve Modules
client.getModules(index, range) - Retrieve a list of modules (Tasks, Projects) from the Zoho Projects portal.
Params:
Name | Description |
index | Enter the index. E.g. 0,1. |
range | Enter the number of modules to retrieve. E.g. 10.
|
Retrieve Portal Users
client.getPortalUsers(filter) - Retrieve a list of users from the Zoho Projects portal.
Params:
Name | Description |
filter | Enter the filter criteria. |
- [
- {
- "name": "Monica Hemsworth",
- "email": "monica.hemsworth@zylker.com",
- "zuid": "96901457",
- "role": "Administrator",
- "roleId": "214815000000068005",
- "profileId": "214815000000068436",
- "companyId": null,
- "client": false,
- "id": "214815000000068003"
- },
- {
- "name": "Chloe Tiff",
- "email": "chloe.t@zylker.com",
- "zuid": "90707086",
- "role": "Administrator",
- "roleId": "214815000000068005",
- "profileId": "214815000000068439",
- "companyId": null,
- "client": false,
- "id": "214815000000117285"
- },
- {
- "name": "Patrick Simon",
- "email": "patrick.simon@zylker.com",
- "zuid": "91617413",
- "role": "Employee",
- "roleId": "214815000000068009",
- "profileId": "214815000000068445",
- "companyId": null,
- "client": false,
- "id": "214815000000117291"
- }
- ]
Retrieve Portal User by ID
client.getPortalUsersById(id) - Retrieve a portal user from the Zoho Projects portal.
Params:
Name | Description |
id | Enter the user ID. |
- {
- "name": "Monica Hemsworth",
- "email": "monica.hemsworth@zylker.com",
- "zuid": "96901457",
- "role": "Administrator",
- "roleId": "214815000000068005",
- "profileId": "214815000000068436",
- "companyId": null,
- "client": false,
- "id": "214815000000068003"
- }
Retrieve Client Users
client.getClientUsers(filter) - Retrieve a list of client users from the Zoho Projects portal.
Params:
Name | Description |
filter | Enter the filter criteria.
|
- [
- {
- "name": "Monica Hemsworth",
- "email": "monica.hemsworth@zylker.com",
- "zuid": "106992208",
- "role": null,
- "roleId": null,
- "profileId": null,
- "companyId": null,
- "client": true,
- "id": "214815000000125051"
- },
- {
- "name": "Patrick Simon",
- "email": "patrick.simon@zylker.com",
- "zuid": "106992208",
- "role": null,
- "roleId": null,
- "profileId": null,
- "companyId": null,
- "client": true,
- "id": "214815000000125051"
- }
- ]
Retrieve Client User by ID
client.getClientUserById(id) - Retrieve a client user from the Zoho Projects portal.
Params:
Name
| Description |
id | Enter the client user ID. |
- {
- "name": "Monica Hemsworth",
- "email": "monica.hemsworth@zylker.com",
- "zuid": "106992208",
- "role": null,
- "roleId": null,
- "profileId": null,
- "companyId": null,
- "client": true,
- "id": "214815000000125051"
- }
Retrieve Client Companies
client.getClientCompanies(filter, range, index) - Retrieve a list of client companies from the Zoho Projects portal.
Params:
Name
| Description |
filter | Enter the filter criteria. |
range | Enter the number of client companies to retrieve. E.g. 10. |
index number | Enter the index. E.g. 0,1. |
- [
- {
- "id": "214815000000125015",
- "name": "Zylker Inc",
- "customerType": 1,
- "addressFirstLine": "",
- "addressSecondLine": "",
- "city": "",
- "state": "",
- "country": "",
- "zipCode": "",
- "webAddress": "",
- "zohoCRMAccountId": null,
- "currencyCode": null,
- "updateTime": null
- },
- {
- "id": "214815000000125016",
- "name": "Zylker Inc",
- "customerType": 1,
- "addressFirstLine": "",
- "addressSecondLine": "",
- "city": "",
- "state": "",
- "country": "",
- "zipCode": "",
- "webAddress": "",
- "zohoCRMAccountId": null,
- "currencyCode": null,
- "updateTime": null
- }
- ]
Retrieve Client Company by ID
client.getClientCompanyById(id) - Retrieve a client company from the Zoho Projects portal.
Params:
Name | Description |
id | Enter the client company ID. |
- {
- "id": "214815000000125057",
- "name": "Zylker Solutions",
- "addressFirstLine": "",
- "addressSecondLine": "",
- "city": "",
- "state": "",
- "country": "",
- "zipCode": "",
- "webAddress": "",
- "zohoCRMAccountId": "-1",
- "updateTime": null
- }
-
client.getClientContacts(filter) - Retrieve a list of client contacts from the Zoho Projects portal.
Params:
Name | Description |
filter | Enter the filter criteria.
|
- [
- {
- "name": "Monica Hemsworth",
- "email": "monica.hemsworth@zylker.com",
- "zuid": null,
- "role": null,
- "roleId": null,
- "profileId": null,
- "companyId": null,
- "client": true,
- "id": "214815000000126133"
- },
- {
- "name": "Chloe Tiff",
- "email": "chloe.tiff@zylker.com",
- "zuid": null,
- "role": null,
- "roleId": null,
- "profileId": null,
- "companyId": null,
- "client": true,
- "id": "214815000000126153"
- }
- ]
client.getClientContactById(id) - Retrieve a client contact from the Zoho Projects portal.
Params:
Name | Description |
id | Enter the client contact ID. |
Retrieve Picklist Options
client.getPicklistOptions(moduleId, layoutId, fieldId) - Retrieve options of a picklist field from a module.
Params:
Name | Description |
moduleId | Enter the module ID. |
layoutId | Enter the layout ID. |
fieldId | Enter the picklist field ID.
|
- [
- {
- "id": "214815000000111775",
- "value": "5"
- },
- {
- "id": "214815000000111787",
- "value": "1"
- },
- {
- "id": "214815000000111789",
- "value": "2"
- },
- {
- "id": "214815000000111791",
- "value": "3"
- },
- {
- "id": "214815000000111793",
- "value": "4"
- }
- ]
Retrieve Status Details
client.getStatusDetails(moduleId, layoutId, statusId) - Retrieve status details from a module.
Params:
Name | Description |
moduleId | Enter the module ID. |
layoutId | Enter the layout ID. |
statusId | Enter the status ID. |
HTTP Requests
CodeX Scripts allow you to communicate with external services and APIs using the HttpRequest object. This enables you to send or retrieve data from third-party systems as part of your script logic.
HTTP requests in CodeX Scripts work in combination with Connections, which securely manage authentication details.
Requirements:
- Only org-based connections are supported in CodeX Scripts.
- Connections that rely on user login credentials are not supported.
- Ensure the required connection is created and authorized before using it in a script.
- const request = new HttpRequest();
- request.url(url);
- request.headers(JSON.stringify(headers));
- request.body(JSON.stringify(body));
- request.connection("connection_link_name");
- request.method("GET");
- request.params(JSON.stringify(params));
- const response = request.execute();
- const { status, statusMessage} = response.asJson();
- console.log(status); // prints either true or false based on success or failure
- console.log(statusMessage.responseText); // prints the API response
- console.log(statusMessage.responseCode); // prints the HTTP response code
- console.log(statusMessage.responseHeader); // prints the response headers
Variables
Variables in Codex Scripts are used to store and retrieve dynamic values during script execution. Use them to store IDs, names, or any reusable values.
Syntax:
For variable names that follow valid javascript-variable naming conventions:
- variables.<var_name>.value
For other valid json keys:
- variables["<var_name>"].value
or - variables['<var_name>'].value