A user event script (for a Sales Order) can hook into events that fire. This user event script fires whenever a Sales order is created (either by a user backend or through the webstore). So my script hooks into the
beforeSubmit
event which occurs right before the Sales Order is created in the database.