Schedule of Rates
Set Schedule of Rates asset types
/a/ScheduleOfRates_setAssetTypes
Replace one Schedule of Rates row’s eligible asset-type ID list.
When to use this endpoint
Use ScheduleOfRates_setAssetTypes for CRM1’s asset-type eligibility editor. The list route uses this stored JSON-like list when a Job targets an asset.
Authentication and permissions
The request must establish tenant context with signed API credentials or a logged-in CRM session. The handler checks for the tenant database prefix rather than calling the normal login guard.
No additional page or role permission is checked. The CRM screens apply their own client-side Schedule of Rates permissions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Positive rate ID. |
vals | Native array or JSON array string | Yes | Complete asset-type ID list. Every member is integer-converted; zeros and duplicates are preserved. An empty list stores []. |
Example request
FM_api('ScheduleOfRates_setAssetTypes', [
'id' => '430001',
'vals' => [7, 9],
]);
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. |
{"error":"missing parameter: vals"} | vals is absent. |
{"error":"invalid parameter: vals"} | The value is not an array and does not decode to one. |
{"error":"schedule of rates does not exist"} | The ID has no row. |
{"ok":1,"msg":"no change needed"} | The existing stored JSON string exactly equals the normalized result. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Asset-type IDs are not checked for existence or active state.
- Null/unrestricted eligibility cannot be written by this endpoint; an empty array is a stored list and is treated differently from SQL null by the Job-context list query.
Side effects
- On change, advances
last_editedand thescheduleOfRatescache marker. - Fires the tenant-configurable
SOR_editevent with the rate ID. Any configured listeners run synchronously and can add integration-specific side effects.
See it in Fieldmotion
CRM1
Edit Asset Types in a Schedule of Rates table row to call this endpoint.
CRM2
CRM2 uses ScheduleOfRate_updateData for the mapped assetTypes field.
Related endpoints
ScheduleOfRates_listapplies this eligibility list for an asset Job context.