Power BI
Export Power BI job data
/a/PowerBI_getJobData
Stream jobs scheduled within a tenant-local date window with reporting-friendly status, cost, and linkage fields.
When to use this endpoint
Use PowerBI_getJobData for the Jobs table in the legacy connector. Unlike the form/table helpers, its direct success response is a complete JSON array.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
from | String | Yes | An exact lower-bound fragment such as >="2026-09-01". It is not a plain date. |
to | String | Yes | An exact upper-bound fragment such as <="2026-09-30 23:59:59". It is not a plain date. |
custom_status | Native array of objects | No | Tenant job statuses in index order, each with name. A non-array uses the six legacy default names. |
priorities | String | No | Newline-separated priority names. Job priority 1 selects the first line. |
Example request
FM_api('PowerBI_getJobData', [
'from' => '>="2026-09-01"',
'to' => '<="2026-09-30 23:59:59"',
'custom_status' => [['name' => 'Open'], ['name' => 'Done']],
'priorities' => "Normal\nUrgent",
]);
Example response
[
{"job_id":"301","job_ref":"J-301","job_customer_id":"1042","job_customer":"Example Ltd","customer_type":"Customer","job_time":"2026-09-03 09:00:00","job_status":"Open","priority":"1","priority_name":"Normal","value":2500,"recurrence":0,"timestamp_started":null,"timestamp_onroute":null,"sor_total_costs":0,"sor_total_price":0,"stock_invoiced_price":0}
]
Rows additionally include assignees, contract/department/form/type, work/cost totals, customer or asset details, completion/start/due dates, mileage/misc/stock data, notes, mobile visibility, prices, raw priority/meta and stored Schedule of Rates fields, user/vehicle fields, and the derived columns described below.
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: from"} | from is absent. |
{"error":"missing or invalid parameter: to"} | to is absent. |
{"error":"invalid parameter: from"} / {"error":"invalid parameter: to"} | A bound has the wrong exact 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
- The bounds are converted from tenant-local time to epochs and applied inclusively to job scheduled time. Soft-deleted jobs are excluded and newest jobs are returned first.
- Customer type 0 exports
Customerand records the ID for the aggregate feed; type 1 exportsAsset. Status and priority names are array-index lookups, so missing indexes become empty strings. job_timeis converted back to tenant-local text. Notes are truncated to 30,000 bytes and every row is recursively converted from ISO-8859-1 to UTF-8.- Metadata supplies numeric
recurrence, integervalue, and second-based start/on-route timestamps converted from stored milliseconds. - Schedule of Rates totals combine current stock average costs and stored/current labour costs. Malformed legacy collection entries and missing IDs are skipped rather than aborting the dataset. Component costs and the configured rate price are added once per valid stored row; the stored rate quantity is not applied to either total.
stock_invoiced_pricetotals stock invoice lines for the job from its direct linked nondeleted invoice. If multiple direct invoice links exist, the last database row retained for the job is used.- The function marks streamed output complete and returns its internal customer/asset ID lists only to an in-process caller; those lists are not part of a direct wire response.
See it in Fieldmotion
CRM1
The legacy connector exposes the streamed array as job_data, supplying tenant status and priority labels from settings.
CRM2
CRM2 does not call this reporting route for job lists or detail screens.
Related endpoints
PowerBI_getFormDataexports main form answers for the same scheduled-time range.PowerBI_getTableDataexports repeating table answers.PowerBI_getDatais the supported aggregate connector feed and supplies tenant settings to this helper.PowerBI_authenticateestablishes the unsigned connector session used by the aggregate feed.