Customers
Set a customer price band
/a/Customer_setPriceBand
Store the price-band identifier used when resolving customer-specific stock and pricing values.
When to use this endpoint
Use Customer_setPriceBand after loading the tenant’s configured price bands and selecting the identifier intended for this customer.
Do not use arbitrary integers: the handler does not verify the reference even though downstream stock and Schedule of Rates pricing expects a valid configured band.
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 | Yes | Customer ID; it must convert to a positive integer. The handler does not verify that the row exists. |
val | Integer-like value | Yes | Price-band ID after intval conversion. Blank becomes zero, and negative or nonexistent IDs are accepted. |
Example request
$result = FM_api('Customer_setPriceBand', [
'id' => '1088',
'val' => '3',
]);
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"} | id is absent or invalid. |
{"error":"missing or invalid parameter: val"} | val is omitted; a present blank value is accepted and stored as zero. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- There is no customer lookup, price-band lookup, active/deleted filter, or no-change check.
- Every accepted request attempts the update and reports success, even if no row was changed.
- The stored band influences price selection in stock and Schedule of Rates workflows; the endpoint itself does not recalculate existing documents.
- This is a single-record mutation; it provides no list filtering or pagination.
Side effects
- The attempted customer write updates
price_band,last_edited, andedited_uuid, and requests customer-cache invalidation. - The handler writes a customer audit event and fires
Customer_editeven if the customer ID did not match a row. Nocustomer_changesrow is added.
See it in Fieldmotion
CRM1
The legacy Customers bulk Set Price Band action reaches Customer_setPriceBand through the dynamic customer setter route.
CRM2
CRM2 has an equivalent bulk price-band action, but its production code uses the broader customer layout update contract rather than this focused endpoint.
Related endpoints
PriceBands_listsupplies configured price-band IDs; that endpoint is not yet documented here.Customer_getretrieves the customer’s storedprice_bandvalue.