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:
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:
- Click the Setup icon in the top right.
- Select Developer Space and click CodeX Scripts.
- Give a name for the script, choose the Task module, select a layout, and choose Before Create as the event.
- Paste the following script into the CodeX terminal and click Save.
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.
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.
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