When to use this endpoint

Use PowerBI_getCustomerData for the connector’s core customer rows and per-table custom rows.

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
fromStringNoAn exact lower-bound fragment such as >="2026-09-01". It is not a plain date.
toStringNoAn exact upper-bound fragment such as <="2026-09-30 23:59:59". It is not a plain date.
cidsNative array of IDsNoSelect specific customers. Values are integer-normalised; a nonempty list takes precedence over the date range.
formatNative layout arrayNoLegacy customer layout used to discover custom fields. Exact integer 0 loads the tenant mainFormat setting; a JSON string is not decoded by this helper.
datasetStringNocustomer_data or customer_table_data. Blank returns both; an unsupported direct value silently falls back to both.

Example request

FM_api('PowerBI_getCustomerData', [
	'from' => '>="2026-09-01"',
	'to' => '<="2026-09-30 23:59:59"',
	'dataset' => 'customer_data',
]);

Example response

{
  "customer_data": [{"customer_id":"1042","customer_name":"Example Ltd","account_manager":"Alex","account_number":"EX-42","department_id":"3","department_name":"Service","type_id":"1","type_name":"Customer","area_id":"8","parent_id":"0","parent_name":"","notes":""}],
  "customer_table_data": []
}

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":"invalid parameter: from"}A nonempty from has the wrong shape.
{"error":"invalid parameter: to"}A nonempty to has the wrong shape.
Malformed custom output or PHP warningsA supplied layout or stored CRM1/CRM2 custom-field definition has an unsupported 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

  • Soft-deleted customers are excluded. With no IDs, both bounds filter customer creation time; a partial range is ignored. With neither filter, all active rows are returned by customer name descending.
  • Core rows include contact/address fields, account manager, department, type, marketing source, work-area ID, coordinates, activity/flag values, and operational counts. Selected metadata is flattened to account_number_sage, email_extra, email_accounting, discount, default_nominal, and default_taxcode.
  • Custom columns are the union of legacy layout field_name values and CRM2 customer custom-layout IDs. Missing saved values become empty strings.
  • Notes longer than 500 bytes are replaced with --NOTES TOO LARGE FOR EXPORT--. Parent names resolve only against nondeleted parents.
  • customer_table_data is keyed by table ID with table_name and data; each row contains customer_id plus configured field labels. Missing table settings or rows return an empty array.
  • There is no client-controlled pagination.

See it in Fieldmotion

CRM1

The legacy connector builds Customers and Customer Table Values entries from the two response keys.

CRM2

CRM2 custom customer layout definitions add custom export columns; CRM2 does not call this route for its customer screens.

Related endpoints