Suppliers
Replace legacy supplier fields
/a/Supplier_edit
Replace the legacy CRM1 supplier form fields in one update.
When to use this endpoint
Use Supplier_edit only with the complete CRM1 supplier edit form. It is not a partial-update route: most omitted fields are written as blank values.
Authentication and permissions
The request must establish an authenticated tenant context with signed API credentials or a logged-in CRM session. This legacy handler checks for the tenant database prefix rather than calling the normal login guard.
It performs no additional Suppliers-page, stock, purchasing, role, create, edit, or delete permission check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive tenant supplier ID. |
name, contact_name, tax_id, phone, account_number, ref_number, email, website | String | No | Replacement values. Every omitted value in this group becomes an empty string. |
street_address1, street_address2, town, county, country, postcode, notes | String | No | Replacement address and notes values. Every omitted value becomes an empty string. |
contact_accounting, email_accounting | String | No | Replace the corresponding keys inside the existing meta object; omission writes an empty string to that key. |
on_hold | Integer-compatible | No | Replacement hold marker; omission becomes 0. |
Example request
$result = FM_api('Supplier_edit', [
'id' => 488104,
'name' => 'Northshore Components',
'contact_name' => 'Aisling Byrne',
'account_number' => 'NS-42',
'on_hold' => 0,
]);
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"} | The ID is absent or not positive. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The handler performs no length, email, duplicate-name, active, or deleted-state validation.
- Unknown IDs and deleted supplier IDs still return
{"ok":1}; a deleted row can be edited because the update has nodeleted=0filter. - Existing metadata keys other than the two accounting keys are preserved.
Side effects
- Advances
last_edited, setsedited_uuidtoSupplier_edit, and clears the supplier cache when a row matches. - Fires the configurable
Supplier_editevent even when no row matched.
See it in Fieldmotion
CRM1
Open Stock → Suppliers in CRM1 and filter browser developer tools for the exact function name. Open a supplier, change its fields, and choose Save.
CRM2
CRM2 does not call this legacy form replacement. Its layout save reaches Supplier_updateData through Layout_setValue.
Related endpoints
Supplier_getsupplies the complete CRM1 edit form before saving.Supplier_updateDatais the mapped partial-update alternative.