task_assign()
Create a task and assign it to a user. The task can be standalone or linked to a record.
Syntax
task_assign(table, recordId, assignee, spec?)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
table |
string | yes* | Table name/id to link the task to. Pass "" for a standalone task. |
recordId |
int | array | yes* | The record id (or $record) to link to. Ignored for standalone tasks. |
assignee |
int | string | array | yes | A user id, an email, or a user-field value. A multi-user value creates one task per assignee. |
spec |
array | yes | title (required), details?, due?, reminder_offset_mins?, reminder_time?. |
due accepts YYYY-MM-DD or a datetime (YYYY-MM-DD HH:MM[:SS]). Times are UTC — pass a record datetime token (already UTC) rather than a hand-typed local time.
Reminders
Set a reminder to notify the assignee before the task is due. Provide one of:
reminder_offset_mins(int) — minutes before the due datetime to remind (e.g.60= one hour before,0= at the due time). Applies only whendueincludes a time.reminder_time(string,HH:MM) — wall-clock UTC time on the due date to remind. Applies only whendueis a date with no time.
You can pass both; the applicable one is chosen automatically from the resolved due (the other is ignored). With no due, reminders are dropped. Reminders deliver within about a minute of the scheduled time.
Returns
The new task id. For a multi-user assignee, a list of task ids.
Example
task_assign("deals", $record["_meta"]["id"], $record["owner"], [
"title" => "Follow up with " . $record["name"],
"details" => "Deal moved to negotiation.",
"due" => sys_current_date()
]);
Example output
4471
Notes
- The task is owned by the flow's acting user (whoever triggered it). On automated triggers with no acting user (cron/webhook), the task is instead owned by the assignee — the assignee is still notified.
- Assignee membership is not enforced — you can assign to any resolvable user.
- Throws if
titleor a resolvableassigneeis missing.
See also: Tasks, flow_text()