Tasks
Set task status in bulk
/a/Tasks_setStatus
Apply one raw numeric status value to a legacy batch of task IDs.
When to use this endpoint
Tasks_setStatus is an unsafe legacy bulk helper retained for compatibility. New code should use Task_updateField with field=status or update each task deliberately.
Authentication and permissions
The request must establish an authenticated tenant context with signed API credentials or a logged-in CRM session. This legacy handler uses the tenant database prefix without calling the normal login guard.
It performs no task, page, role, ownership, or privacy-permission check. Any visibility restriction described below comes from request filters or a specific server-side rule, not from a general Tasks permission check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | Native array | Yes | Task IDs inserted directly into an SQL IN list. Send a nonempty array containing numeric IDs only. |
val | Numeric string | Yes | Raw status expression. Intended values are 0 New, 1 Open, 2 Closed, and 3 Archived, but the handler does not enforce that allowlist or quote/escape the value. |
Example request
$result = FM_api('Tasks_setStatus', [
'ids' => ['318', '319'],
'val' => '2',
]);
Example response
{
"ok": 1
}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"missing or invalid parameter: ID"} | ids is absent. |
{"error":"missing or invalid parameter: Val"} | val is absent. Blank is accepted. |
{"ok":1} | Also returned when no task matches. There is no affected-row count. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The update has no
deleted=0condition, so matching soft-deleted tasks are changed as well. - It does not validate task existence, status range, transition rules, ownership, or privacy. An empty/scalar
idsvalue is not cleanly handled.
Side effects
- Updates only
statusand invalidates the task cache. It does not updatelast_edited, write field history, send notices/notifications, or log per-task outcomes.
See it in Fieldmotion
CRM1
No direct CRM1 caller was found.
CRM2
No direct CRM2 caller was found. Current CRM2 bulk status changes use Task_updateData.
Related endpoints
Task_setStatusis the single-task legacy setter.Task_updateFieldprovides an allowlisted multi-ID field update with timestamps and audit history.