JavaScript SDK for CodeX Scripts | Help | Zoho Projects

JavaScript SDK for CodeX Scripts

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.

Info
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 
record
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.
  1. If the record contains an id, the existing record is updated.
  2. 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.
Response
  1. {
  2. "id":"175513000000135011",
  3. "layoutId":"175513000000027008",
  4. "projectId":"175513000000135011",
  5. "moduleId":"175513000000027005",
  6. "end_date":"2025-12-15",
  7. "hourly_budget":"500.000",
  8. "revenue_budget":"15000.000",
  9. "billing_method":"2",
  10. "is_public_project":false,
  11. "description":"<div>Revamp of Zylker's client portal.</div>",
  12. "is_strict_project":true,
  13. "cost_per_hour":"500.000",
  14. "currency":"INR",
  15. "tracking_method":"1",
  16. "budget_type":"5",
  17. "start_date":"2025-08-01",
  18. "owner":"175513000000060003",
  19. "project_type":"active",
  20. "created_time":"1726215358660",
  21. "is_rollup_project":false,
  22. "created_by":"175513000000060003",
  23. "cost_budget":"10000.000",
  24. "percent_complete":"17",
  25. "rate_per_hour":"1000.000",
  26. "last_updated_time":"1749370606429",
  27. "completed_time":null,
  28. "name":"Zylker Website Revamp",
  29. "updated_by":"175513000000060004",
  30. "project_group":"175513000000025001",
  31. "fixed_cost":"0.000",
  32. "status":"175513000000027104"
  33. }

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.
Response
  1.  {

  2.   "id": "214815000000120442",

  3.   "layoutId": "214815000000111729",

  4.   "projectId": "214815000000120442",

  5.   "moduleId": "214815000000027005",

  6.   "end_date": "1755196800000",

  7.   "hourly_budget": "120.000",

  8.   "revenue_budget": "85000.000",

  9.   "billing_method": "4",

  10.   "cf_decimal": "7.50",

  11.   "is_public_project": false,

  12.   "cf_number": "456",

  13.   "description": "Mobile app development for Zylker Retail.",

  14.   "is_strict_project": true,

  15.   "cf_email": "monica.hemsworth@zylker.com",

  16.   "cost_per_hour": "75.000",

  17.   "cf_multi_line": "API integration pending <br> \\n Client approval required",

  18.   "cf_currency": "820.5000",

  19.   "currency": "USD",

  20.   "tracking_method": "1",

  21.   "cf_multi_user_picklist": [

  22.     "214815000000117285"

  23.   ],

  24.   "budget_type": "2",

  25.   "start_date": "1754524800000",

  26.   "owner": "214815000000117285",

  27.   "project_type": "active",

  28.   "created_time": "1753082475000",

  29.   "cf_pick_list": "214815000000111779",

  30.   "is_rollup_project": false,

  31.   "cf_url": "https://projects.zylker.com/resource-hub",

  32.   "cf_checkbox": true,

  33.   "created_by": "214815000000068003",

  34.   "cost_budget": "60000.000",

  35.   "percent_complete": "25",

  36.   "cf_single_line": "Initial phase completed",

  37.   "cf_user_pick_list": null,

  38.   "rate_per_hour": "110.000",

  39.   "cost_budget_threshold": "50000.000",

  40.   "cf_phone": "9876543210",

  41.   "hourly_budget_threshold": "90.000",

  42.   "cf_percentage": "0.85",

  43.   "last_updated_time": "1755738857000",

  44.   "completed_time": null,

  45.   "name": "Zylker Mobile App Dev",

  46.   "updated_by": "214815000000068003",

  47.   "project_group": "214815000000118849",

  48.   "fixed_cost": "10000.000",

  49.   "cf_multi_select": null,

  50.   "cf_date_field": "1754611200000",

  51.   "status": "214815000000027092"

  52. }

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.
Sample Filter Object
  1. {
  2. active: true|false
  3. }

Response:

  1. [
  2.   {
  3.     "name": "Monica Hemsworth",
  4.     "email": "monica.hemsworth@zylker.com",
  5.     "zuid": "96901457",
  6.     "role": "Administrator",
  7.     "roleId": "214815000000068005",
  8.     "profileId": "214815000000068436",
  9.     "companyId": null,
  10.     "client": false,
  11.     "id": "214815000000068003"
  12.   },
  13.   {
  14.     "name": "Chloe Tiff",
  15.     "email": "chloe.t@zylker.com",
  16.     "zuid": "90707086",
  17.     "role": "Administrator",
  18.     "roleId": "214815000000068005",
  19.     "profileId": "214815000000068439",
  20.     "companyId": null,
  21.     "client": false,
  22.     "id": "214815000000117285"
  23.   },
  24.   {
  25.     "name": "Patrick Simon",
  26.     "email": "patrick.simon@zylker.com",
  27.     "zuid": "91617413",
  28.     "role": "Employee",
  29.     "roleId": "214815000000068009",
  30.     "profileId": "214815000000068445",
  31.     "companyId": null,
  32.     "client": false,
  33.     "id": "214815000000117291"
  34.   }
  35. ]

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.
Response
  1. {
  2.   "name": "Monica Hemsworth",
  3.   "email": "monica.hemsworth@zylker.com",
  4.   "zuid": "96901457",
  5.   "role": "Administrator",
  6.   "roleId": "214815000000068005",
  7.   "profileId": "214815000000068436",
  8.   "companyId": null,
  9.   "client": false,
  10.   "id": "214815000000068003"
  11. }
 

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.
Sample Filter Object
  1. {
  2. active: true|false
  3. }

Response

  1. [
  2.   {
  3.     "name": "Monica Hemsworth",
  4.     "email": "monica.hemsworth@zylker.com",
  5.     "zuid": "106992208",
  6.     "role": null,
  7.     "roleId": null,
  8.     "profileId": null,
  9.     "companyId": null,
  10.     "client": true,
  11.     "id": "214815000000125051"
  12.   },
  13.   {
  14.     "name": "Patrick Simon",
  15.     "email": "patrick.simon@zylker.com",
  16.     "zuid": "106992208",
  17.     "role": null,
  18.     "roleId": null,
  19.     "profileId": null,
  20.     "companyId": null,
  21.     "client": true,
  22.     "id": "214815000000125051"
  23.   }
  24. ]

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.

Response
  1. {
  2.   "name": "Monica Hemsworth",
  3.   "email": "monica.hemsworth@zylker.com",
  4.   "zuid": "106992208",
  5.   "role": null,
  6.   "roleId": null,
  7.   "profileId": null,
  8.   "companyId": null,
  9.   "client": true,
  10.   "id": "214815000000125051"
  11. }

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.
Sample Filter Object
  1. {
  2.   "project": projectId
  3. }
Response
  1. [
  2.   {
  3.     "id": "214815000000125015",
  4.     "name": "Zylker Inc",
  5.     "customerType": 1,
  6.     "addressFirstLine": "",
  7.     "addressSecondLine": "",
  8.     "city": "",
  9.     "state": "",
  10.     "country": "",
  11.     "zipCode": "",
  12.     "webAddress": "",
  13.     "zohoCRMAccountId": null,
  14.     "currencyCode": null,
  15.     "updateTime": null
  16.   },
  17.   {
  18.     "id": "214815000000125016",
  19.     "name": "Zylker Inc",
  20.     "customerType": 1,
  21.     "addressFirstLine": "",
  22.     "addressSecondLine": "",
  23.     "city": "",
  24.     "state": "",
  25.     "country": "",
  26.     "zipCode": "",
  27.     "webAddress": "",
  28.     "zohoCRMAccountId": null,
  29.     "currencyCode": null,
  30.     "updateTime": null
  31.   }
  32. ]

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

  1. {
  2.   "id": "214815000000125057",
  3.   "name": "Zylker Solutions",
  4.   "addressFirstLine": "",
  5.   "addressSecondLine": "",
  6.   "city": "",
  7.   "state": "",
  8.   "country": "",
  9.   "zipCode": "",
  10.   "webAddress": "",
  11.   "zohoCRMAccountId": "-1",
  12.   "updateTime": null
  13. }
  14.  

Retrieve Client Contacts

client.getClientContacts(filter) -  Retrieve a list of client contacts from the Zoho Projects portal.

Params:
Name
Description 
filter
Enter the filter criteria.
Sample Filter Object
  1. {
  2. active: true|false
  3. }
Response

  1. [
  2.   {
  3.     "name": "Monica Hemsworth",
  4.     "email": "monica.hemsworth@zylker.com",
  5.     "zuid": null,
  6.     "role": null,
  7.     "roleId": null,
  8.     "profileId": null,
  9.     "companyId": null,
  10.     "client": true,
  11.     "id": "214815000000126133"
  12.   },
  13.   {
  14.     "name": "Chloe Tiff",
  15.     "email": "chloe.tiff@zylker.com",
  16.     "zuid": null,
  17.     "role": null,
  18.     "roleId": null,
  19.     "profileId": null,
  20.     "companyId": null,
  21.     "client": true,
  22.     "id": "214815000000126153"
  23.   }
  24. ]

Retrieve Client Contact by ID

client.getClientContactById(id) - Retrieve a client contact from the Zoho Projects portal.

Params:
Name
Description 
id
Enter the client contact ID.
Response
  1. {
  2.   "id": "214815000000126153",
  3.   "zuid": null,
  4.   "email": "monica.hemsworth@zylker.com",
  5.   "name": "Monica Hemsworth",
  6.   "client": true
  7. }

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.

Response

  1. [
  2.   {
  3.     "id": "214815000000111775",
  4.     "value": "5"
  5.   },
  6.   {
  7.     "id": "214815000000111787",
  8.     "value": "1"
  9.   },
  10.   {
  11.     "id": "214815000000111789",
  12.     "value": "2"
  13.   },
  14.   {
  15.     "id": "214815000000111791",
  16.     "value": "3"
  17.   },
  18.   {
  19.     "id": "214815000000111793",
  20.     "value": "4"
  21.   }
  22. ]

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:
  1. Only org-based connections are supported in CodeX Scripts.
  2. Connections that rely on user login credentials are not supported.
  3. Ensure the required connection is created and authorized before using it in a script.
  1. const request = new HttpRequest();
  2. request.url(url);
  3. request.headers(JSON.stringify(headers));
  4. request.body(JSON.stringify(body));
  5. request.connection("connection_link_name");
  6. request.method("GET");
  7. request.params(JSON.stringify(params));
  8. const response = request.execute();
  9. const { status, statusMessage} = response.asJson();
  10. console.log(status); // prints either true or false based on success or failure
  11. console.log(statusMessage.responseText); // prints the API response
  12. console.log(statusMessage.responseCode); // prints the HTTP response code
  13. 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:
  1. variables.<var_name>.value
For other valid json keys:
  1. variables["<var_name>"].value
    or
  2. variables['<var_name>'].value

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsEnterpriseOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceAccessible Forms
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit

                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic Forms
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsFormstack alternativeEncrypted Forms

                              Wufoo alternativeSecure Forms

                              TypeformWCAG


                                          Create. Review. Publish.

                                          Write, edit, collaborate on, and publish documents to different content management platforms.

                                          Get Started Now




                                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                Manage your brands on social media


                                                                  • Desk Community Learning Series


                                                                  • Digest


                                                                  • Functions


                                                                  • Meetups


                                                                  • Kbase


                                                                  • Resources


                                                                  • Glossary


                                                                  • Desk Marketplace


                                                                  • MVP Corner


                                                                  • Word of the Day


                                                                  • Ask the Experts


                                                                    Zoho Sheet Resources

                                                                     

                                                                        Zoho Forms Resources


                                                                          Secure your business
                                                                          communication with Zoho Mail


                                                                          Mail on the move with
                                                                          Zoho Mail mobile application

                                                                            Stay on top of your schedule
                                                                            at all times


                                                                            Carry your calendar with you
                                                                            Anytime, anywhere




                                                                                  Zoho Sign Resources

                                                                                    Sign, Paperless!

                                                                                    Sign and send business documents on the go!

                                                                                    Get Started Now




                                                                                            Zoho TeamInbox Resources





                                                                                                      Zoho DataPrep Demo

                                                                                                      Get a personalized demo or POC

                                                                                                      REGISTER NOW


                                                                                                        Design. Discuss. Deliver.

                                                                                                        Create visually engaging stories with Zoho Show.

                                                                                                        Get Started Now








                                                                                                                            • Related Articles

                                                                                                                            • Working with CodeX Scripts

                                                                                                                              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 ...
                                                                                                                            • CodeX Scripts - Intro

                                                                                                                              CodeX Scripts let you define custom logic that runs automatically when users interact with tasks or projects. It allows users to control how the module behaves based on certain conditions. Users can write scripts using JavaScript SDKs to trigger ...
                                                                                                                            • CodeX Scripts for Projects

                                                                                                                              CodeX Scripts in Zoho Projects are advanced conditional logic scripts that help enforce specific rules and validations. Users can control how and when a project can be created, edited, or transitioned. This ensures better compliance and process ...
                                                                                                                            • CodeX Scripts for Tasks

                                                                                                                              CodeX Scripts in Zoho Projects are advanced conditional logic scripts that help enforce specific rules and validations. Users can control how and when tasks can be created, edited, or transitioned. This ensures better compliance and process ...
                                                                                                                            • CodeX Credits

                                                                                                                              CodeX credits allows admins to monitor and analyze the number of CodeX script executions in Zoho Projects. Each time a script is executed, it uses one credit. Credits are allocated based on the organizations' subscription plan and will reset every ...
                                                                                                                              Wherever you are is as good as
                                                                                                                              your workplace

                                                                                                                                Resources

                                                                                                                                Videos

                                                                                                                                Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                eBooks

                                                                                                                                Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                Webinars

                                                                                                                                Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                CRM Tips

                                                                                                                                Make the most of Zoho CRM with these useful tips.



                                                                                                                                  Zoho Show Resources