Contract types
Update one contract-type field
/a/ContractType_updateField
Apply one low-level contract-type map field to one or more explicit IDs.
When to use this endpoint
Use ContractType_updateField only for trusted bulk maintenance. Normal CRM2 saves use ContractType_updateData.
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 |
|---|---|---|---|
field | String | Yes | Exact map key: id, name, disableInvoicing, lastEdited, or meta. |
val | Mixed | Yes | Replacement value. Null is treated as absent. Type conversion follows the map and names are limited to 64 Unicode characters. |
id / ids | Integer string or array | Yes | Target IDs; id takes precedence. Native arrays are supported, but JSON array strings are converted to integer zero rather than decoded. Missing rows are ignored. |
Example request
$result = FM_api('ContractType_updateField', [
'ids' => ['31', '32'],
'field' => 'disableInvoicing',
'val' => '1',
]);
Example response
{
"ok": 1,
"oldData": [
{"id": "31", "disable_invoicing": "0"},
{"id": "32", "disable_invoicing": "0"}
]
}
When no matched row needs a change, the endpoint returns {"ok":"1","warning":"no change required"} and omits oldData.
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: field"} | field is absent. |
{"error":"missing or invalid parameter: val"} | val is absent or null. |
{"error":"missing or invalid field"} | The key is outside the map. |
{"error":"missing or invalid parameter: id/ids"} | Neither target key is supplied. |
{"error":"name is too long."} | A name value exceeds 64 Unicode characters. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Changed normal columns are updated in one statement. Missing IDs produce no per-ID status.
field=lastEditeddoes not preserve the supplied timestamp because current server time is appended to every changed update.- Tenant feature bit
64controls visibility of the Contracts UI but is not checked by this handler.
Side effects
- Updates matched rows, refreshes
last_edited, invalidates the cache, and writes one generic audit entry naming all changed IDs.
See it in Fieldmotion
CRM1
A production-source search found no direct CRM1 caller.
CRM2
A production-source search found no direct CRM2 caller; the Contract Types table uses ContractType_updateData.
Related endpoints
ContractType_updateDatais the normal mapped update.Contract_updateDataassigns types to contracts.