Price bands and stock pricing
Delete a price band and clear customer links
/a/PriceBand_delete
Permanently remove one price-band row and reset matching customer assignments to zero.
When to use this endpoint
Use only after checking customer assignments and retained per-item overrides. This route is permanent deletion, not the usual business-object soft-delete workflow.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session; all normal calls use that tenant. These handlers do not enforce an additional role or finance-page permission.
Use strings for signed numeric values, including values inside native arrays. Only JSON-encode parameters explicitly described as JSON text; see Getting started.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible scalar | Yes | Converted with intval; must be positive. Zero, omission and invalid text are rejected; an absent row is not created. |
Example request
$result = FM_api('PriceBand_delete', ['id'=>'1042']);
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 coerced ID is less than one. |
{"error":"price band does not exist"} | The positive ID has no tenant row, or its lookup fails. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Validates the ID before login, then checks that the band exists. Repeating a successful delete returns price band does not exist.
- Clears price_band on all matching tenant customers, including soft-deleted customers. It does not advance their last_edited or edited_uuid checkpoints.
- Retains stored stock and schedule-of-rates JSON entries keyed by the removed ID. It does not rewrite existing document lines or recalculate historical totals.
- The mobile app has no direct caller for this endpoint in the searched JavaScript or
m/wwwintermediary. It downloads price bands throughsyncDownloadsinto its localpriceBandstable.
Side effects
- Hard-deletes the tenant price_bands row and updates customer references to zero. No cache invalidation, history event, deletes-log entry, notification or external request is requested by this handler.
See it in Fieldmotion
CRM1
Open Settings → Finance → Price Bands and choose Delete on a row. The browser confirmation precedes PriceBand_delete; there is no equivalent confirmation flag enforced by the API.
CRM2
Select bands in Settings → Finance → Price Bands and choose bulk Delete. Filter PriceBand_delete: CRM2 sends individual IDs sequentially, not one array.
Related endpoints
PriceBand_getreads one raw row, including integer timestamps.PriceBand_getRequestedDetailsreads mapped fields for one or several IDs.