Schedule of Rates
Query the mapped Schedule of Rates table
/a/ScheduleOfRates_getDataTable
Query Schedule of Rates rows through CRM2’s named field map with shared filters and pagination.
When to use this endpoint
Use ScheduleOfRates_getDataTable for CRM2’s configurable Schedule of Rates table or its unpaged export-ID discovery pass.
Authentication and permissions
This handler does not call the normal login guard or explicitly check for a tenant database prefix. Normal API dispatch must still establish tenant context; the PHP function itself must not be treated as an authorization boundary.
No page or role permission is checked. CRM2 hides actions and columns according to its client-side Schedule of Rates permissions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fields | Native array | Yes | Requested mapped names from name, code, stockUsed, cost, lastEdited, description, meta, metaNominal, metaNominalID, metaNominalCode, metaTaxTypeID, assetTypes, labourUsed, priceBands, archived, and metaCustomerCosts. Unknown names are ignored and id is always included. taxType returns a composite object. |
isTable | Integer string | No | Defaults to table mode. Exact integer 0 returns only data and enables optional limit. |
draw / start / length | Integer strings | No | Table counter, offset, and page size; defaults are 0, 0, and 10. No endpoint maximum is applied. |
limit | Integer string | No | Positive non-table limit. Zero or a negative value leaves non-table output unlimited. |
orderBy / orderDesc | Mapped field / direction | No | Explicit named ordering. Matching falls back case-insensitively, then to a requested field. Direction is inserted from this trusted CRM control without normalization. |
order[0][column] / order[0][dir] | DataTables values | No | Fallback ordering; the helper subtracts one for CRM2’s leading action column. Exact desc reverses the result. |
searchValue / searchField | String / mapped name(s) | No | Case-insensitive substring search over selected or all mapped fields. Asset-type display search uses a scalar join that does not reliably represent the stored JSON-array field. |
Mapped field filters | Scalar or native array | No | Text/JSON scalars use case-insensitive substring matching; numeric scalars use equality; arrays use IN. Common filters are id, name, code, archived, and assetTypes. |
advanceSearch / groupBy | Native arrays | No | Shared CRM2 condition objects and mapped grouping. |
Example request
$page = FM_api('ScheduleOfRates_getDataTable', [
'fields' => ['id', 'name', 'code', 'cost', 'archived'],
'archived' => 0,
'start' => 0,
'length' => 25,
'draw' => 7,
'orderBy' => 'name',
'orderDesc' => 'asc',
]);
Example response
{
"data": [
{"id":"430001","name":"Annual service","code":"AS-01","cost":"150","archived":"0"}
],
"draw": 7,
"recordsTotal": "24",
"recordsFiltered": "18"
}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"missing or invalid parameter: fields"} | fields is absent. |
{"error":"error in database query"} | The generated selection/filter/order query fails. |
Runtime warning or type error | A list/composite parameter has an unsupported scalar shape. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Archived rows are included unless filtered. The table has no deleted flag.
- Table mode returns counts across all tenant rows and the filtered query. Non-table mode returns only
data. - Stored JSON/text fields remain encoded; nested metadata map fields are extracted.
taxTypeis composed from tax-type and nominal IDs. - Legacy advanced-search objects containing raw
whereexpressions are trusted internal UI input and should not be constructed by third parties.
See it in Fieldmotion
CRM1
CRM1 uses ScheduleOfRates_getDT.
CRM2
Open Stock → Schedule of Rates. The shared table sends visible fields, filters, search, order, and paging here; export first calls non-table mode with fields=["id"].
Related endpoints
ScheduleOfRates_getDTis CRM1’s positional table.ScheduleOfRate_getRequestedDetailsreturns unpaged mapped details with an explicit login guard.