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

ParameterTypeRequiredDescription
fromStringYesAn exact lower-bound fragment such as >="2026-09-01". It is not a plain date.
toStringYesAn exact upper-bound fragment such as <="2026-09-30 23:59:59". It is not a plain date.
custom_statusNative array of objectsNoTenant job statuses in index order, each with name. A non-array uses the six legacy default names.
prioritiesStringNoNewline-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

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: 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 Customer and records the ID for the aggregate feed; type 1 exports Asset. Status and priority names are array-index lookups, so missing indexes become empty strings.
  • job_time is 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, integer value, 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_price totals 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