Invoices
Update one invoice field
POST
/a/Invoice_updateField
Update one mapped invoice field, with Workflow-aware delegation for status changes.
When to use this endpoint
Use this for inline CRM2 edits where sending an entire layout payload would be unnecessary.
Authentication and permissions
The request must use a logged-in CRM session or valid signed API credentials and is scoped to that tenant.
Users whose legacy crm_access mask contains bit 64 receive {"error":"no permission to access api"}. No record-owner check is made.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id / ids | Integer / array | Yes | One invoice ID or a list of IDs. |
field | String | Yes | Mapped invoice field name. For a Workflow-enabled status change only, key=status is also recognized by the delegation pre-check. |
val | Mixed | Yes | Replacement value. For a Workflow-enabled status change only, value is also recognized by the delegated status call. Ordinary mapped writes require field and val. |
Example request
$result = FM_api('Invoice_updateField', ['id' => 981, 'field' => 'notes', 'val' => 'Updated']);
Example response
{
"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: field"} | No field/key is supplied. |
{"error":"missing or invalid parameter: val"} | No value alias is supplied. |
{"error":"missing or invalid field"} | The name is absent from the invoice field map. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- When the field is
statusand Workflow is enabled, every supplied ID is passed toInvoice_setStatusand processing stops at the first error. Other fields use the generic mapped updater. - Status 4 is rejected when real credit notes are enabled. Non-status fields do not run the broader notices, snapshots, row, or recurrence handling in
Invoice_updateData.
Side effects
- Generic writes follow DataProcess field conversion. Workflow status writes run all
Invoice_setStatusside effects.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found.
CRM2
The Job Invoice page uses this route for inline fields; generic mapped components can also submit it.
Related endpoints
Invoices_getDataTablesupplies paginated CRM2 invoice rows and IDs.Invoices_getDTis the CRM1 invoice-list counterpart.