When to use this endpoint

Use PowerBI_getSorData for the Schedules of Rates table in the legacy connector.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session so that the tenant database and user context are available. The handler performs no page or role-permission check.

This direct dataset route does not consume the unsigned api_id/api_key pair used by the Power BI connector. Use PowerBI_getData for the self-authenticating connector feed.

Parameters

This endpoint has no operation-specific parameters.

Example request

FM_api('PowerBI_getSorData');

Example response

[
  {"sor_id":"14","sor_name":"Annual Service","sor_code":"AS01","price":"150.00","description":"Annual service rate","asset_types":"[]","labour":"Alex x 2 hours - total cost 50","stock":"Item code FILTER x 1 - total cost 12.5","nominal_code":"4000","tax_rate":"20","tax_type":"T1"}
]

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.
PHP warnings or partial valuesStored labour/stock/meta JSON is malformed or a legacy labour user no longer exists.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • All rate rows are returned by rate name descending, with no date filter or pagination.
  • price is the stored rate cost. Nominal and tax values are flattened from metadata; the raw metadata, labour_used, and stock_used fields are removed. asset_types remains in its stored representation.
  • New labour objects use their stored hours/cost and resolve the current user name. A new row with no stored cost falls back to current user hourly cost only in the contract helper, not here.
  • Legacy labour and stock arrays use boolean value || 0 expressions for quantities. Any nonzero stored quantity therefore renders and calculates as 1, not its original amount.
  • Missing stock rows render blank item details. A missing legacy labour user can leave an uncached lookup and trigger warnings.
  • The aggregate feed exposes this array as sor_data for module=all-sors and includes it in module=all.

See it in Fieldmotion

CRM1

The legacy connector displays the flattened labour and stock descriptions in its Schedules of Rates table.

CRM2

CRM2 does not call this reporting route for rate management.

Related endpoints

  • PowerBI_getData is the supported aggregate connector feed and supplies tenant settings to this helper.
  • PowerBI_authenticate establishes the unsigned connector session used by the aggregate feed.