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

ParameterTypeRequiredDescription
idsNative arrayYesTask IDs inserted directly into an SQL IN list. Send a nonempty array containing numeric IDs only.
valNumeric stringYesRaw 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

ResponseCondition
{"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=0 condition, so matching soft-deleted tasks are changed as well.
  • It does not validate task/type existence, ownership, or privacy. An empty/scalar ids value is not cleanly handled.

Side effects

  • Updates only type and invalidates the task cache. It does not update last_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