Task types
Create a legacy task type
/a/TaskType_new
Create a named task type through the compact legacy CRM1 workflow.
When to use this endpoint
Use TaskType_new for CRM1’s task-type picker/settings dialog or when task import needs to create a missing type. CRM2’s generic layout uses TaskType_createData.
Authentication and permissions
The request must establish an authenticated tenant context with signed API credentials or a logged-in CRM session. This legacy handler checks or immediately uses the tenant database prefix rather than calling the normal login guard.
It performs no additional Settings-page, role, create, edit, or delete permission check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Trimmed task-type name. It must contain a non-whitespace character. There is no uniqueness or maximum-length check in this handler. |
Example request
$type = FM_api('TaskType_new', [
'name' => 'Customer follow-up',
]);
Example response
{
"ok": 1,
"id": 3
}
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":"invalid or missing parameter: name"} | name is absent, blank, or whitespace-only. |
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 stored name is trimmed. Duplicate names are allowed.
- Creation and last-edited timestamps are set to the current server
Y-m-d H:i:svalue. They cannot be supplied through this route.
Side effects
- Inserts one permanent
task_typesrow and invalidates the task-type cache. It does not write mapped audit history or update existing tasks.
See it in Fieldmotion
CRM1
Open Settings → Task Types and select “add new type”, or choose “add new type” in the task editor. CRM1 calls TaskType_new.
CRM2
No direct CRM2 caller was found. CRM2’s Task Type Create layout derives TaskType_createData through its shared widget.
Related endpoints
TaskType_createDatais the mapped creation route.TaskTypes_listlists the resulting ID and name.