Tasks
Set task type in bulk
/a/Tasks_setType
Apply one raw task-type ID to a legacy batch of task IDs.
When to use this endpoint
Tasks_setType is an unsafe legacy bulk helper retained for compatibility. New code should use Task_updateField with field=type or update tasks individually.
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 task-type ID expression. The related task-type row is not checked, and the value is not normalized, quoted, or escaped. |
Example request
$result = FM_api('Tasks_setType', [
'ids' => ['318', '319'],
'val' => '3',
]);
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 or the type ID has no task-type row. |
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/type existence, ownership, or privacy. An empty/scalar
idsvalue is not cleanly handled.
Side effects
- Updates only
typeand invalidates the task cache. It does not updatelast_edited, write field history, or produce notifications.
See it in Fieldmotion
CRM1
No direct CRM1 caller was found.
CRM2
No direct CRM2 caller was found. Current CRM2 bulk type changes use Task_updateData.
Related endpoints
Task_setTypeis the single-task legacy setter.Task_updateFieldprovides an allowlisted multi-ID field update with timestamps and audit history.TaskTypes_listlists the current task-type IDs.