Skip to content

Delegation and out of office

There are two ways a task reaches someone other than the approver: an out-of-office rule, set in advance, and a manual hand-over of one task.

A rule sends new tasks of one user to another for a period. The new task carries the original approver’s vote in onBehalfOf, and the audit trail shows both.

await rungs.delegations.set({
fromUserId: "u_maria",
toUserId: "u_omar",
startsAt: "2026-03-02T00:00:00.000Z",
endsAt: "2026-03-09T00:00:00.000Z",
});
const request = await submit("LV-1");
const [task] = request.steps[0]?.tasks ?? [];
console.log(task?.assigneeId, task?.onBehalfOf); // "u_omar" "u_maria"

Runs in CI:examples/docs-snippets/src/concepts/delegation.ts

  • Rules can be limited to some flows (scope: { flowKeys }) or one tenant.
  • Chains are followed up to maxDelegationDepth (default 3), and a cycle keeps the task with the original approver (EC-21, EC-22).
  • A delegate who is the requester, inactive, or already holds a vote in the step is skipped, so nobody gets two votes (EC-23, EC-48).
  • Ending a rule does not pull back tasks already delegated (EC-24). The original approver can still decide them directly (EC-60).
// After the rule ended, Maria hands one task to a colleague herself.
const handed = await rungs.delegate({
requestId: second.id,
taskId: secondTask?.id ?? "",
actorId: "u_maria",
toUserId: "u_lena",
comment: "Lena knows this team",
});

Runs in CI:examples/docs-snippets/src/concepts/delegation.ts

The same checks apply. Handing a task back to the approver it acts for is always allowed (EC-50).