Suppliers
Update mapped supplier fields
/a/Supplier_updateData
Partially update mapped supplier fields while recording change history and supplier extension events.
When to use this endpoint
Use Supplier_updateData for camel-cased mapped fields. CRM2 reaches it indirectly through Layout_setValue when saving a Supplier Update layout.
Unlike Supplier_edit, omitted mapped fields are preserved.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler calls the normal login guard but performs no additional Suppliers-page, stock, purchasing, role, create, edit, or delete permission check.
All records are selected from the authenticated tenant. CRM1 and CRM2 hide some controls through client-side permissions, but these endpoints do not repeat those UI checks.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible or array | Yes | Supplier ID. The shared updater also accepts a native array, but callers should use one scalar ID because wrapper events and mention processing are designed for one supplier. |
name | String | No | Supplier name. It must be nonempty when creating through the mapped route. |
contactName, streetAddress1, streetAddress2, town, county, country | String | No | Contact and address values. country maps directly to the tenant table’s three-character country column. |
postcode | String | No | Maximum 20 characters. |
email | Email string | No | Maximum 64 characters. A nonblank value must pass PHP email validation. |
phone | String | No | Maximum 40 characters. |
notes | String or notes JSON | No | Supplier notes. When the value is a notes array, newly added @username tokens can create Fieldmotion notices. |
website, terms, accountNumber, type | String | No | Mapped supplier text fields. The mapped website field has no application-level 64-character limit. |
taxId | String | No | Maximum 20 characters. |
refNumber | String | No | Maximum 16 characters. |
isActive, onHold | Integer-compatible | No | Converted with intval(). Conventionally use 0 or 1. |
meta | String | No | Complete raw metadata value. Prefer the named accounting fields when changing their keys. |
accountsContact, accountsEmail, additionalEmail | String | No | Stored inside meta as contact_accounting, email_accounting, and email_extra. accountsEmail validates a nonblank email address. |
customValues | JSON-compatible value | No | Stored in custom_values. Creation defaults it to an empty JSON object. |
createDate, lastEdited | SQL datetime string | No | Default to the server’s current date and time on creation. Normal updates advance lastEdited automatically. |
editedUuid | String | No | Mapped synchronization marker. |
Example request
$result = FM_api('Supplier_updateData', [
'id' => 488104,
'phone' => '+353 1 555 0199',
'onHold' => 1,
]);
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: id"} | No id key is present. |
{"error":"Invalid email address."} | A mapped email field is nonblank but invalid. |
{"error":"phone is too long."} | A submitted mapped value exceeds its configured maximum; the field name varies. |
{"warning":"no updated fields."} | The request contains an ID but no recognized mapped field. |
{"warning":"No data."} | No active supplier has the ID. |
{"warning":"No Change."} | All recognized values already match the row. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Only provided mapped fields are considered. Unknown fields are ignored.
- Deleted suppliers are excluded and cannot be updated through this route.
lastEditedadvances automatically when at least one value changes.
Side effects
- Clears the supplier cache and writes field-level history entries for changed values.
- Can create notices for usernames newly mentioned in structured notes.
- Fires the configurable
Supplier_editevent after a non-error wrapper result, including warning responses.
See it in Fieldmotion
CRM1
CRM1 does not use this route for its supplier form; it calls Supplier_edit.
CRM2
Open Stock → Suppliers in CRM2 and filter browser developer tools for the exact function name. Open a supplier through a configured Supplier Update layout and save it. The browser calls Layout_setValue, which dispatches internally here.
Related endpoints
Supplier_updateFieldchanges one mapped field directly.Supplier_getRequestedDetailsreads the same mapped names.Supplier_editis the complete legacy form replacement.