Zoho Projects CodeX Scripts for Time Logs: 10 Rules

Zoho Projects: CodeX Scripts for Time Logs

CodeX Scripts in Zoho Projects are conditional logic scripts that enforce your own rules and validations. For time logs, they let you control how and when logs can be created, updated, blocked, or moved on. Where the built-in time log restrictions are not specific enough, a CodeX Script can express almost any rule your team needs.

Availability: CodeX Scripts are supported in all Zoho data centres except CN, JP, and AE.

How these scripts behave

Zoho publishes ready-made example scripts for ten common rules. Each one checks the time log or logs being saved and, if any break the rule, rejects them and returns a list of violations that names the log, the user, and the reason. Several of the examples look up task details through the Zoho Projects API, and the holiday and leave examples read from Zoho People, so they depend on connections to those services being in place. Zoho's page holds the full code for each. This article describes what every script does so you can pick the right starting point.

The ten example rules

Rule What it does
Restrict logs by task work hoursStops users logging more time than the total work hours allocated to a task. It also blocks logging against tasks that have no work hours assigned.
Restrict logs for unassigned tasks or issuesAllows logging only against tasks or issues that have at least one owner. Logs against unassigned work items are rejected.
Restrict weekend logsBlocks time logged on Saturdays and Sundays by checking the selected log date.
Restrict logs on holidaysBlocks entries on organisation holidays, using holiday information retrieved from Zoho People.
Restrict logs during leave or time offStops users logging time on days they are on approved leave, using leave records from Zoho People.
Allow logs only for task or issue ownersOnly users assigned as owners of a task or issue can log time against it. Unassigned work and unauthorised users are blocked.
Restrict logs for tasks in reviewStops logging against tasks whose status is In Review, so time is recorded only during active execution.
Restrict general time logsBlocks general logs that are not linked to a task or issue, so every entry is tied to a work item.
Restrict logs to the current dayAllows logging only for today's date, blocking both backdated and future-dated entries.
Restrict logs for tasksStops logging against tasks entirely. Useful where time may be logged only against issues or as general logs.

Choosing between a script and a built-in setting

  • Several of these rules overlap with built-in time log restrictions, such as holidays, weekends, leave, task work hours, and task owners. Where a built-in setting does what you need, it is simpler to maintain than a script.
  • Reach for a script when you need to combine conditions, or to enforce something the settings cannot express, such as blocking logs on tasks in a particular status or refusing general logs altogether.
  • Test any script in a sandbox project first, because a script that rejects logs wrongly will stop people recording time.
Need help? As a Zoho Partner serving the UK and Ireland, we can write, test, and deploy CodeX Scripts for your Zoho Projects portal, including checks against Zoho People holidays and leave. Book a discovery call with 1 Cloud Consultants.