Customer types
Update customer-type mapped fields
/a/CustomerType_updateData
Update one or several customer types through CRM2’s named field map.
When to use this endpoint
Use CustomerType_updateData when saving CRM2 configurable fields or applying the same mapped changes to multiple known type IDs.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.
The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string or native array | Yes | One ID or an already-decoded ID array. The plural key ids is not accepted. Array mode processes targets independently and discards individual results. |
name | String | No | Replacement raw name. Blank and duplicate values are accepted. |
allowedNext | String | No | Replacement allowed_next text without transition-ID validation. |
triggers | String or JSON-compatible value | No | Replacement raw trigger value. Arrays/objects are JSON-encoded; strings are stored verbatim. |
lastEdited | Datetime string | No | Recognized mapped key, but an accepted update writes current server time rather than the supplied value. |
colourHex | String | No | Replacement colour without format or length validation. |
Example request
$updated = FM_api('CustomerType_updateData', [
'id' => '12',
'name' => 'Commercial accounts',
'colourHex' => '#224466',
]);
Example response
{
"ok": 1
}
Scalar no-op input returns {"warning":"No Change."}; a missing row returns {"warning":"No data."}; unknown update keys return {"warning":"no updated fields."}. Supplying only id returns {"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"} | The id key is absent, including when only ids is supplied. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Unknown keys are ignored. The primary
idmap entry is not treated as a writable business field by this multi-field operation. - The helper advances
last_editedto current server time. In array mode, missing target IDs and per-row failures are hidden by the final{"ok":1}. The batch is not transactional. - The handler invokes the shared mention-notice helper, but this map has no note/mention field, so normal customer-type updates do not produce mention notifications.
Side effects
- Updates accepted fields, invalidates the customer-type cache, and writes generic field audit entries.
- It does not change existing customers or run saved email triggers.
See it in Fieldmotion
CRM1
No production CRM1 caller was found; CRM1’s legacy form uses CustomerType_save.
CRM2
Open Settings → Customer Types and save the configurable detail form. The shared display widget derives this endpoint from its API prefix.
Related endpoints
CustomerType_getRequestedDetailsreads the same map.CustomerType_saveapplies legacy format checks.