Reporting dashboards and targets
Retrieve legacy monthly targets table
/a/ReportsTargets_getDT
Return one positional January–December target row per user for a year and target type.
When to use this endpoint
Use this feed to display existing monthly targets before editing or deleting them. Initialize annual rows with the creation endpoint; this call never fills missing months.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session; all rows belong to that tenant.
Employer feature bit 8192 is required by both target feeds and mutations. No additional page-role, department, ownership, or target-user permission check is enforced.
For signed form requests, sign numeric scalar values as strings, including values inside native nested arrays. Send JSON text only for parameters explicitly accepting JSON strings; see Getting started.
These reporting handlers require tenant schema upgrade 794 before deployment. No request path creates or repairs schema.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
draw | Integer-compatible | Yes | Echoed as an integer. |
type | Integer-compatible | Yes | CRM target editors use 0 Quote Won, 1 Invoice Paid, 2 Job, and 3 Opportunity. The handler does not enforce this list. |
year | Integer-compatible | Yes | Target calendar year. No range validation. |
start / length | Integer-compatible | No | Start is a nonnegative user-row offset, default 0. Length defaults to 100; 0 also means 100 and -1 means all remaining rows. Paging is applied after pivoting and search. |
search[value] | String | No | Case-insensitive literal substring search on user name or user ID after pivoting, not monthly target-row ID. Empty text leaves the result unrestricted. |
Example request
$result = FM_api('ReportsTargets_getDT', ['draw'=> '1','year'=> '2026','type'=> '0','start'=> '0','length'=> '25']);
Example response
{"draw":1,"recordsTotal":1,"recordsFiltered":1,"data":[[912,[7,"Sample User"],1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,""]]}
For complete annual data: column 0 is the last monthly target-row ID (normally December), column 1 is [integer userID, name], columns 2–13 are January–December integer targets, and the final column is empty text.
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: draw"} | Required draw is absent or invalid. |
{"error":"missing or invalid parameter: type"} | Required type is absent or invalid. |
{"error":"missing or invalid parameter: year"} | Required year is absent or invalid. |
{"error":"no permission to access api"} | Employer feature bit 8192 is unset. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- recordsTotal counts all matching user groups before search; recordsFiltered counts after search, before paging. Empty pages return data:[].
- Monthly rows are selected by user/type/year/month/id and pivoted into a fixed 15-element row. Missing months are zero-filled; duplicate months use the last row in that order.
- User names are resolved without active filtering; missing users have an empty name. Month values outside 0..11 are ignored. The row identity column remains the last encountered monthly row ID, normally December.
- Year/type/draw/paging are validated integers. Search is a literal substring, not SQL; custom order parameters remain unused.
Side effects
- Read-only; no records or edit timestamps are changed.
See it in Fieldmotion
CRM1
The Report Target page’s legacy DataTable uses this feed and interprets the positional month columns. Filter browser Network requests for ReportsTargets_getDT.
CRM2
No direct CRM2 caller of this endpoint was found. The modern Report Targets display table uses ReportsTargets_getDataTable.
Related endpoints
ReportsTarget_newinitializes the twelve monthly rows.ReportsTargets_getDataTablesupplies named month fields for CRM2.