Update Many Records at Once in Zoho Creator with Deluge

Mass Update Records in a Zoho Creator Database

Every price rises, every category gets renamed, every field eventually needs backfilling. The pattern is always the same: select the records you mean with a criteria set, loop them, write the change. The whole technique is two lines — what matters is the care around them.

Written from scratch. The original entry for this topic was a single sentence and an embedded video. The video is on YouTube and is included below, but the written article is new.

The pattern

// ============================================
// MASS UPDATE — run from a scheduled function,
// not from a form workflow.
// ============================================

void Updates.repriceCategory(string categoryName, decimal pctIncrease)
{
factor = 1 + (pctIncrease / 100);
changed = 0;

// Filter in the query. Never fetch everything and test inside the loop.
for each prod in Product[Category == categoryName && Active == true]
{
oldPrice = ifnull(prod.Price,0);
if(oldPrice > 0)
{
prod.Previous_Price = oldPrice; // keep an audit trail
prod.Price = (oldPrice * factor).round(2);
prod.Price_Updated = zoho.currentdate;
changed = changed + 1;
}
}

info "Repriced " + changed + " products in " + categoryName;
}

Video walkthrough

Notes

  • Put the filter in the criteria, not in an if. Product[Category == x && Active == true] asks the database for the right rows. Fetching everything and testing inside the loop pulls the whole table into memory and will hit the iteration cap on any real dataset.
  • Run it once against one record first. Add && ID == 12345 to the criteria, confirm the result, then remove it. There is no undo on a mass update.
  • Keep the previous value. Previous_Price costs one field and turns an irreversible mistake into a recoverable one.
  • Scheduled function, not form workflow. Anything touching more than a few hundred rows will exceed the script timeout if it runs inside a form submission.
  • Count what you changed. The changed counter is how you find out the criteria matched nothing — otherwise a script that quietly did zero work looks identical to one that succeeded.

This script is part of the free Creator Scripts Deluge Library.

All 39 Deluge scripts, the full Zoho Creator course, and every downloadable asset are now free. Get free access →