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?. |
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.
Returns
The new task id. For a multi-user assignee, a list of task ids. Returns null (and logs) when there is no acting user to own the task.
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 skipped and logged — not an error.
- Assignee membership is not enforced — you can assign to any resolvable user.
- Throws if
titleor a resolvableassigneeis missing.
See also: Tasks, flow_text()