Customizing form events in Zoho Projects with CodeX

Customizing form events in Zoho Projects with CodeX


Dear users,

Beyond Task Lists is a series of articles aimed at showcasing the various customization capabilities of Zoho Projects. We'll discuss real life project management scenarios, use cases, and requirements that needs combining multiple features. This article is about using CodeX to customize the tasks and projects module.

Zoho Projects offers comprehensive automation and customization for modern project management: workflows, blueprints, and business rules. But when you want to make that near impossible customization happen, CodeX is here to help.

With CodeX, you can use Javascript SDKs on the project or task records before or after creating, editing, or deleting them. (Note: CodeX scripting is available in the free plan and all paid plans. Execution is limited by CodeX credits.)

This includes special cases like:

Info
1. Applying restrictions to record updates
2. Restricting field edits unless conditions are met or until a status changes

Use case:

An Indian firm with multiple locations needs to file tasks by region. Each task layout has drop-downs for the state and city, but users often mismatch the selections, causing confusion. In this case, workflow automation doesn't solve the issue.

The solution flow:
  1. Click the Setup icon in the top right.

  2. Select Developer Space and click CodeX Scripts.

  3. Give a name for the script, choose the Task module, select a layout, and choose Before Create as the event.

  4. Paste the following script into the CodeX terminal and click Save.
    1. function main() {

      // define states and cities
      const states = [
      {
      state: "Tamil Nadu",
      cities: ["Madurai","Chennai","Trichy"]
      },
      {
      state: "Karnataka",
      cities: ["Tumkur", "Mysuru", "Bangaluru"]
      },
      {
      state: "Kerala",
      cities: ["Cochin", "Ernakulam", "Kottayam"]
      }
      ];

      // capture state selection
      let state = current.record.state;

      // capture city selection
      let city = current.record.city;

      // Find matching state
      const stateObj = states.find(s => s.state === state);

      // Validate city against district
      if (!stateObj.cities.includes(city)) {
      throw new ScriptError(` ${city} is not in $(state)`);
      }
      }
      




      This way, when a city not in the corresponding state is selected, the system throws a custom-defined error.

Idea
Pro-Tip: With CodeX, you can also:

1. Make HTTP requests to other apps.
2. Update tasks or project records based on conditions.
3. Retrieve record details and update other project records in your portal.

Take a look at our help docs for more details - CodeX in Projects.

Have questions you think might require CodeX? Reach out to us and we can help. Want us to write about an aspect of Zoho Projects in detail? Let us know and we can add it to our list.

Best,
Zoho Projects Team


      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          • Sticky Posts

          • CodeX Scripts for Enforcing Custom Project Logic

            Every organization has a defined way of executing projects. There are clear expectations around how tasks should move, when projects should progress, and which actions require validation. When these rules are consistently followed, projects remain structured
          • Automation Series: Auto-create Dependent Task on Status Change

            In Zoho Projects, you can automatically create and assign a dependent task when a task’s status is updated. This helps teams stay aligned, ensures reviews happen on time, and reduces manual effort. In this post, we’ll walk through an easy setup using
          • Time Log Reminder

            Tracking the time spent on tasks and issues is one of the most important functions of a timesheet. However, users may forget to update the time logs because they have their own goals to achieve. But, time logs must be updated at regular intervals to keep
          • Introducing the Zoho Projects Learning Space

            Every product has its learning curve, and sometimes having a guided path makes the learning experience smoother. With that goal, we introduce a dedicated learning space for Zoho Projects, a platform where you can explore lessons, learn at your own pace,
          • Update on V2 API End-of-Life Timeline

            Dear Users, Earlier this year, we shared the launch of the V3 APIs and requested users to migrate from the older V2 APIs by December 2025. We have received valuable feedback from our users and partners regarding their migration timelines. We are happy

          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ




                                ご検討中の方