NS Admin Lab

← Lab

SuiteScript

Workflow and User Event on the same record

Published

A workflow and a User Event Script on the same record. Which one runs first?

Nobody asks… until a sales order ends up with a value nobody set.

What the documentation says

  • In afterSubmit, the User Event finishes first. The workflow actions run after it.
  • If several User Events run on the same record, you set their order in Scripted Records.
  • One User Event doesn’t trigger another: if your script saves a different record, that record’s User Events don’t run.

Where it gets tricky

  • The script sets a field, and the workflow changes it again afterwards.
  • The script saves the record again, and the workflow evaluates a state it no longer expects.
  • Nobody knows both exist: different people built them at different times.

Rule of thumb: every field has exactly one owner. Either the workflow controls it or the script does. Never both. Before you touch a record, check which scripts and workflows already run on it.

Sources

Let’s talk

Comments on this note? Message me on LinkedIn.

Go to my LinkedIn ↗