Working with CodeX Scripts | Help | Zoho Projects

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 that align with your business requirements.
InfoCodeX 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

 

  1. Each script execution uses 1 CodeX credit.
  2. Credits reset automatically every month, and the reset date adjusts according to your portal’s timezone.
  3. 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  

The client object provides built-in methods to interact with the system.

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.
  1. Click in the top-right corner.
  2. Navigate to Developer Space > CodeX Scripts.
  3. Click Variables in the top-right corner.
  4. Click Create Variable.
  5. Enter the name and choose the scope:
  6. Select Global to use it across all scripts.
  7. Select Script to restrict usage to a specific script, then choose the script and enter the value.
  8. Click Save.

To use a variable in your CodeX Script:  
  1. If the variable name follows JavaScript variable naming rules:
    variables.<var_name>.value
  2. 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.
  1. Click  in the top-right corner.
  2. Navigate to Developer Space > CodeX Scripts.
  3. Click Create CodeX Scripts in the top-right corner.
  4. Enter the CodeX Script Name.
  5. Select the Module, Layout, and the Event.
  6. Write the script with logic in the editor.
    1. Use current. to explore supported objects and properties.
    2. Use client. to explore supported methods to perform actions.
  7. 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

  1. Click  in the top-right corner.
  2. Navigate to Developer Space > CodeX Scripts.
  3. Click the CodeX Script you wish to edit.
  4. Make necessary changes and click Save.
Notes
Module cannot be edited once the CodeX Script is saved.

Enable CodeX Script

  1. Click  in the top-right corner.
  2. Navigate to Developer Space > CodeX Scripts.
  3. Toggle on the status to enable the CodeX Script.
    1. To disable it, toggle off the status.

Reorder CodeX Script

Reorder codeX Scripts to change the order of the execution.
  1. Click  in the top-right corner.
  2. Navigate to Developer Space > CodeX Scripts.
  3. 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:
  1. Up to 3 Before-event scripts
  2. 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.
Notes
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.

  1. Click  in the top-right corner.
  2. Navigate to Developer Space > CodeX Scripts.
  3. Click the Filter icon in the top-right corner of the script list.
  4. Choose one or more filter criteria from the list.
  5. Choose Any of these or All of these to define how filters should be applied.
  6. Click Find to apply the filter.

View Execution Logs

  1. Click  in the top-right corner.
  2. Navigate to Developer Space > CodeX Scripts.
  3. Click  in the top-right corner.
  4. Select Logs to view the execution logs.
  5. 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

  1. Click  in the top-right corner.
  2. Navigate to Developer Space > CodeX Scripts.
  3. Hover over the CodeX Script, click  > Delete.
  4. Confirm your action.

More Reads


      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

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