Skip to content

Approvals

Approvals

An approval holds a change until the right people agree. The change is saved provisionally, so everyone sees it marked as pending, and it is undone if rejected. You add one by returning ctx.approve(…) from a policy verdict. There is no separate workflow to build.

// the contractor's update grant, now with an approval
update: {
	fields: ['status', 'amount_charged', 'summary'],
	verdict: function* (changes, ctx) {
		const me = ctx.actor.kind === 'member' ? ctx.actor.id : null;
		const other = changes.findIndex(({ before }) => before.assignee_user_id !== me);
		if (other >= 0) return yield* ctx.refuse('errors.job_not_yours', { row: other });
		// progress saves at once
		if (!changes.some((c) => c.changed('amount_charged'))) return ctx.allow();
		// a charge waits for the teams that hold the controller policy
		const { sys_team } = yield* ctx.query({
			sys_team: { where: { policies: { has: 'field_ops_controller' } }, fields: ['id'] }
		});
		const [first, ...rest] = sys_team.rows.map((team) => team.id);
		if (!first) return yield* ctx.refuse('errors.no_controller_team');
		return ctx.approve({ steps: [{ name: 'Controller review', teams: [first, ...rest] }] });
	}
}

Here a contractor's progress update saves at once, but a change to the amount charged waits for a controller. The verdict reads the teams that hold the controller policy, and refuses by name when none does.

What happens when it runs

  1. A contractor changes the amount charged on their job and saves. The verdict returns ctx.approve(...).
  2. The change is saved provisionally and marked pending. Field controllers see the request on the record and in their inbox.
  3. A controller approves: the request closes and the new amount stands. If the controller rejects instead, the amount goes back to what it was. If they request changes, the contractor edits and saves, which resubmits.

Steps

steps is a list of named steps, decided one after another by members of each step's teams or by its users. Both are ids the verdict reads from rows: the teams that hold a policy, or a team or member the record names. superseded_by lists teams whose members may decide the whole request. Staff read sys_team without a grant; a policy held by external members or by an automation grants its default output. Build the list with ordinary code: add a step only for large amounts, or return ctx.allow() when no review is needed. The flow is saved with the request, so a later release does not change requests already open.

Decisions

When a record is under approval, its History timeline shows each step and its footer offers the decisions you may make:

DecisionWhoResult
approveA member of the current step's teams, or one of its usersMoves to the next step, or approves the change after the last one. A reason is optional.
rejectA member of the current step's teams, or one of its usersUndoes the change: an edit is restored, a new record is removed, a deleted record comes back. A reason is required.
request_changesA member of the current step's teams, or one of its usersKeeps the data and hands it back. The requester edits and saves, which resubmits the same request. A reason is required.
withdrawThe requester, while the request is openTakes the request back and undoes the change, as a rejection does.
approve with a reasonA member of a superseded_by teamDecides the whole request at once and keeps the data.

Approved, rejected, withdrawn and superseded requests are final. Automations, integrations and envoys never decide approvals.

History weaves each step — done, waiting, changes requested or upcoming — into the record timeline. Decision buttons sit in the record footer, and while changes are requested the requester's Save button reads Resubmit.

While a change is pending

Held records are locked on every path, including imports and syncs. Only the current approvers may edit them, and after changes are requested only the requester may. While the request is open, anyone who may decide one of its steps can read the records it holds. Outgoing syncs wait for the decision. Each held row carries $approval with its state and step, and shared tables and boards show it.

What people see

Approval actions and step history live inside every record, so these screens need no code.

Record sheet for a new contact named Purchasing desk, marked Under approval, with its History timeline showing Commercial review waiting and a Withdraw button in the footer.
A sales rep's new contact waits for Commercial review. The rep can still withdraw it from the footer.
Contact record showing Changes requested, its History timeline listing Commercial review and the reason Please add the desk phone number so logistics can reach them, with Saving resubmits for approval and Withdraw in the footer.
The commercial manager asks for changes. The reason stays in the record History for the requester.
History timeline of the contact: Commercial review waiting above version 2 (adding the phone, Waiting for approval), the commercial manager's request for changes, and version 1.
The rep adds the phone number and resubmits. History shows the edit, and the request waits for review again.
Contact record after approval with its History timeline open: requested, changes requested, resubmitted with the phone, and approved with the reason Phone added. Approved for order follow-up.
Approved: the contact is saved, with the approver's reason and every step of the round in History.
Approval summary for the removed contact Accounts payable: Commercial review rejected by the commercial manager, reason Finance contacts are kept by the finance team, not sales.
Rejected on create: the new contact is never saved, and the reason is kept.
Order TR-2026-0010 back in draft with its History timeline showing the rejection by the commercial manager: Black masterbatch is below this week's floor, requote at CNY 9.20.
Rejected on update: the order's confirmation is undone and the order returns to a draft.
Delete confirmation: Delete 1 record? This will ask for approval; the record stays until it is approved.
Deleting a record that needs approval says so before anything happens.
Sales orders table where order TR-2026-0120 is struck through with an amber edge, pending deletion, among ordinary draft orders.
While the delete waits, the order stays in the table, struck through and marked Pending deletion.
Order TR-2026-0120, still active, with History showing the rejected delete request: Keep this draft, the customer confirmed a revised quantity for next week.
Rejected on delete: the draft order stays, with the reason in its History.
Approval summary for the removed contact Receiving dock: withdrawn by the sales rep, reason Duplicate of the purchasing desk contact.
Withdrawn by the requester before anyone decided. The change is discarded.
Approvals inbox listing an order delete pending Commercial review with an Approve button, a rejected order update, a rejected contact and an approved contact.
The approvals inbox: what waits for you, and what you already decided.

Deciding from your own page

import { fork } from '@norbital-ai/ui/effect';

// request_id comes from the write's pending_approval outcome or the row's $approval
fork(
	ctx.approvals.decide(request_id, {
		decision: 'request_changes',
		reason: 'Attach the receipt for the charge.'
	}),
	(failure) => (problem = failure._tag)
);

Every record already places these controls in its footer and its steps in History, so most workspaces need no code. ctx.approvals.get(id) returns a request with its steps, its timeline and the decisions the viewer may make.

Reacting to approvals

A model's effects receive approval events with ctx.event.kind === 'approval', so you can send your own notices when a request opens, moves or ends. Rows carried with on_approved are saved only when the final approval lands.