Power of Automation :: Preventing Infinite Loops in Zoho Projects - A Smart Approach to Task Workflow Automation

Power of Automation :: Preventing Infinite Loops in Zoho Projects - A Smart Approach to Task Workflow Automation

Hello Everyone,

Today, we’re excited to share a smart solution to a common issue in Zoho Projects: Infinite loops caused by Task Workflow Rules and Custom Functions.

Use Case:

In a task layout, the two custom fields—
Gross Rate (GR) and Net Rate (NR) —are automated as follows:

  • When a user updates GR, the system updates NR using the formula
    NR = GR × 0.85
  • When a user updates NR, the system updates GR using the formula
    GR = NR / 0.85

The Problem : Infinite Loop

If each field update triggers a workflow, they will keep calling each other indefinitely, creating an infinite loop. Since Zoho Projects allows workflows to trigger one another, this can quickly become a serious issue.

The Solution: Break the Loop with a Simple Check

We can 
prevent these infinite loops by ensuring that an update only happens when necessary.

✅ Before updating a field, check if the new value is different from the existing value.
✅ Only proceed with the update if a change is actually needed.

Implementation Steps :

We have composed the custom functions which helps in updating these custom fields.

1️⃣ Calculate the new value using the custom functions provided.
2️⃣ Compare it with the existing value before calling the Update Task API.
3️⃣ Update the field only if the value has changed to prevent unnecessary API calls.

Example in Action:

  • Suppose you update GR to 1000 in the UI.
  • The system calculates NR as:
    NR = 1000 × 0.85 = 850
  • Before updating, it checks the existing NR value:
    • If NR is already 850, no update is made. 🚫 (Prevents infinite loop)
    • If NR is different, it updates to 850, triggering the next workflow.
  • When the second workflow recalculates GR, it compares the new value with the existing one. Since they match, no further update occurs—breaking the loop. ✅

    We have attached the required screenshots & custom function scripts for reference.

Final Thoughts:

By applying this simple check, we can ensure smooth automation in Zoho Projects while avoiding infinite loops. This approach not only enhances workflow efficiency but also prevents unnecessary API calls, improving overall system performance.

We hope you found this post useful. If you have any questions, feel free to share them in the comments below.

    • Sticky Posts

    • Introducing Version-3 APIs - Explore New APIs & Enhancements

      Happy to announce the release of Version 3 (V3) APIs with an easy to use interface, new APIs, and more examples to help you understand and access the APIs better. V3 APIs can be accessed through our new link, where you can explore our complete documentation,
    • Schedule Exports for Regular Project Updates

      Tracking project data often means exporting data at regular intervals. Instead of manually exporting data every time, users can schedule exports for Phases, Tasks, and Tasks in Zoho Projects. These exports can be set to run once, daily, weekly, or monthly
    • Set Custom Business Calendars and Holidays for Global Teams

      Managing a project across diverse teams means accounting for more than just tasks and deadlines; it means acknowledging how and when each team actually works. Users might follow different working days or observe region-specific holidays that cannot be
    • Restore Trashed Records Anytime Within 30 Days

      Access the recycle bin from the Data Administration tab under the settings page in Zoho Projects, which gives better control over the trashed data. When records like projects, phases, task lists, tasks, issues, or project templates are trashed, they are
    • Organize and Clone Task Custom Views

      We have rolled out two new enhancements to task custom views: Custom View Groups and Custom View Clone. Custom View Groups Similar to predefined view groups, we have introduced groups for custom views to help organize and categorize them. My Custom Views: