← All articles

Automations: when this happens, do that — Update a linked record, and do arithmetic

An Update the record step doesn't have to change the record that triggered it. Which record to update also lists the relations on that table, so you can follow one and write to what it points at — “when a dispatch is created, update the linked part”. Each assignment also picks an operation: Set to, Increase by or Decrease by. For the last two the value is the amount, and it can be a token — {{record.qty}} — so a dispatch of three units takes three off stock. That combination is what lets automations do real inventory work: decrement on hand when something ships, add it back on a return, roll a counter forward. Increases and decreases are applied by the database in a single operation, so two runs firing at the same time can't both read the same starting number and overwrite each other. Stock stays correct under concurrent dispatches. Tick Never let it go below zero and a decrease that would go negative writes nothing and fails the step instead — you get a failed run to look at rather than a quietly negative balance.
Nothing here answered it? Ask us directly — we usually reply within one working day.

Made with RowFold