Autorun AI Docs

7. Event

context.event is the payload that fired this process. Its shape depends on the component event you connected.


Button click / row action

On a button sitting on a table row or a details page, context.event is the record in scope.

await context.sdk.entities.update({
  params: { entitySlug: "printjobs", recordId: context.event.ID },
  json: { PrintStatusID: 14 }
});

On a details page you can also use context.router.id — they are usually the same value. On a list/table, prefer context.event.ID because there is no id in the URL.


Page load

onLoad typically receives null. Read the route instead:

const id = context.router.id;
if (!id) return;

Field / table onChange

The payload is { updates, innerValue }.

context.event.updates

sync · returns object

The new values for fields that just changed. Only those fields are present. Assigning back onto updates sets a computed value as part of the same save.

const updates = context.event.updates;
const innerValue = context.event.innerValue;

if (updates.Price) {
  updates.TotalItemAmount =
    Number(updates.Price) * Number(innerValue.Quantity);
}

context.event.innerValue

sync · returns object

The record before the change. Use it for fields that were not part of this edit.

if (updates.Quantity) {
  updates.TotalItemAmount =
    Number(innerValue.Price) * Number(updates.Quantity);
}
Pro tip

Use updates for changed fields and innerValue for unchanged ones. Mixing them up is the most common source of undefined in onChange processes. For lookups, the stored value is often innerValue.Customer.ID, not innerValue.Customer.

function valueOf(field) {
  return updates[field] ?? innerValue[field]?.ID ?? innerValue[field];
}