When to use this endpoint

Use PowerBI_getQuoteData for the connector’s Quotes and Quote Line Items tables.

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.
datasetStringNoAccepted by the aggregate feed but ignored by this helper: a direct call always calculates quote rows, line items, and cids.

Example request

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

Example response

{
  "quote_data": [{"quote_id":"63","quote_num":"Q-63","quote_customer_id":"1042","quote_customer":"Example Ltd","quote_date":"2026-09-03 11:00:00","quote_status":"Quoted","job_id":"301","job_ref":"J-301","jobs":[{"to_id":"63","from_id":"301"}],"sale_chance_date":"2026-10-01","total_net":"100.00","total_tax":"20.00","total_gross":"120.00"}],
  "quote_lineitem_data": [{"quote_id":"63","item type":"Stock","description":"Filter","quantity":"2","cost":"20","price":"50","tax_percent":"20","gross_price":"60","cost_total":"40","net_total":"100","gross_total":"120","group":"Parts"}],
  "cids": ["1042"]
}

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"}from is absent or has the wrong shape.
{"error":"invalid parameter: to"}to is absent or has the wrong shape.
Malformed/partial line items or PHP warningsStored quote cost metadata has unsupported structures or omits fields required by its cost type.

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 inclusive bounds apply to quote creation time. Soft-deleted quotes are excluded and results are newest first; there is no pagination.
  • Status codes map from -1 through 7 to Draft, Quoted, Won, Paid, Cancelled, Needs Customer Approval, Approved By Customer, Lost, and Further Action Required.
  • Active job links are returned as raw to_id/from_id objects. When has_jobs is positive, the first link supplies the top-level job ID/reference; an absent link leaves the stored flag value and - reference.
  • sale_chance_date is flattened from metadata. The raw metadata is removed; cids contains the unique customer IDs encountered.
  • Line items are reconstructed from metadata groups stock, sor, labour, other, and verbose. Non-verbose items require a positive amount; verbose rows always use quantity 1. Missing totals are derived from unit values and quantity.
  • Stock descriptions resolve current nondeleted stock names and fall back to UNKNOWN. The output key is literally item type with a space; Schedule of Rates descriptions contain the stored ID rather than a resolved name.

See it in Fieldmotion

CRM1

The legacy connector exposes quote headers and reconstructed lines as separate tables.

CRM2

CRM2 does not use this export route for quote screens.

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.