When to use this endpoint

Use ScheduleOfRates_setPriceBands from either CRM rate editor to store fixed prices keyed by price-band ID.

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 page or role-permission check.

All reads and writes use the authenticated tenant. The CRM screens apply client-side Schedule of Rates permissions, but those controls are not repeated by this endpoint.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPositive rate ID.
valNative array/objectNoComplete price-band mapping. Native array/object values are JSON-encoded. Any non-array value—including a JSON string—sets SQL null.

Example request

FM_api('ScheduleOfRates_setPriceBands', [
	'id' => '430001',
	'val' => [
		'2' => 145,
		'3' => 140,
	],
]);

Example response

{
  "ok": 1
}

Errors and unusual responses

ResponseCondition
{"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.
{"error":"schedule of rates does not exist"}The ID has no 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

  • Price-band IDs and numeric values are not validated or normalized by this setter. CRM callers send numeric prices keyed by existing fixed price-band IDs.
  • Relative price bands are calculated later from base cost and their relative_multiple; callers normally omit them from this mapping.
  • The endpoint always writes and fires its event, even when the encoded value is unchanged.

Side effects

  • Advances last_edited and the scheduleOfRates cache marker.
  • Fires the tenant-configurable SOR_edit event with the rate ID. Any configured listeners run synchronously and can add integration-specific side effects.

See it in Fieldmotion

CRM1

Open the Price Bands editor from a Schedule of Rates row and save.

CRM2

Open the rate’s Price Bands dialog and save fixed band prices.

Related endpoints