Contract types
Update contract-type mapped fields
/a/ContractType_updateData
Update one or more contract classifications through CRM2’s named field map.
When to use this endpoint
Use ContractType_updateData for CRM2’s Contract Types edits. Use ContractType_edit only when reproducing CRM1’s stricter name-only dialog.
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 array | Yes | Target ID or native array of IDs. Scalar mode returns row-specific warnings; array mode discards every per-row result and returns {"ok":1}. |
name | String | No | Replacement name, maximum 64 Unicode characters. Blank and duplicate names are accepted. |
disableInvoicing | Integer string | No | Complete replacement flag after integer conversion. CRM2 uses 0 for invoiceable and 1 for not invoiceable; other integers are accepted. |
meta | String or JSON-compatible value | No | Replaces the complete raw metadata value. |
lastEdited | Datetime string | No | Accepted by the map, but any changed update appends current server time after mapped values, so the supplied timestamp does not survive. |
noRecord | Array | No | Mapped keys whose generic audit entries should be marked hidden; it does not suppress writes. |
Example request
$result = FM_api('ContractType_updateData', [
'id' => '31',
'name' => 'Planned maintenance',
'disableInvoicing' => '0',
]);
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. |
{"error":"name is too long."} | name 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
- Unknown keys are ignored. UI readonly flags are not API write protection, and the route does not enforce name uniqueness or the usual 0/1 range.
- The operation has no filtering or pagination beyond explicit target IDs.
- Tenant feature bit
64controls visibility of the Contracts UI but is not checked by this handler.
Side effects
- Changed rows receive current
last_edited, contract-type cache invalidation, and one generic audit entry per changed field. - Existing contracts keep their type IDs; no notification is sent.
See it in Fieldmotion
CRM1
A production-source search found no primary CRM1 caller; CRM1 renames through ContractType_edit.
CRM2
Edit a row on Contracts → Types. The shared display widget derives ContractType_updateData for inline and form saves.
Related endpoints
ContractType_updateFieldapplies one map key to multiple rows.ContractType_createDatacreates the mapped shape.