Reporting dashboards and targets
Retrieve CRM2 monthly targets table
/a/ReportsTargets_getDataTable
Return named month fields for the CRM2 reporting-target display table.
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 |
|---|---|---|---|
year | Integer-compatible | No | Optional nonnegative integer year. Fractional/malformed values are rejected; omission selects all years. |
type | Native array of integer-compatible values | No | Native array of nonnegative integers; malformed members are rejected. Empty arrays return no rows. Scalars and JSON strings remain ignored for compatibility. |
draw / start / length / search / order | Mixed | No | Not used for paging, searching, ordering, or echoing draw; returned draw is always zero. |
Example request
$result = FM_api('ReportsTargets_getDataTable', ['year'=> '2026','type'=>['0']]);
Example response
{"data":[{"january":1000,"february":1100,"march":1200,"april":1300,"may":1400,"june":1500,"july":1600,"august":1700,"september":1800,"october":1900,"november":2000,"december":2100,"name":"Sample User","year":"2026","type":"0","id":"7-2026-0"}],"draw":0,"recordsTotal":1,"recordsFiltered":1}
Month values are integers, year/type database scalars, and id is the userID-year-type string. Empty results return data:[] with zero counts.
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":"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
- The pivot key is the composite userID-year-type, so equal arithmetic sums cannot merge unrelated target groups. Only active monthly target rows are loaded.
- All twelve lowercase month fields are present, with missing months zero-filled. Duplicate monthly rows use the last row by user/type/year/month/id order; invalid historical months are ignored.
- No server-side paging or search is applied. Both counts are the number of distinct composite groups; draw is always zero. User names include inactive users and missing users have an empty name.
Side effects
- Read-only; no records or edit timestamps are changed.
See it in Fieldmotion
CRM1
No direct caller was found; CRM1 uses the positional legacy target feed.
CRM2
Report Targets configures the generic display-table API prefix ReportsTargets, which resolves to this endpoint. Editors split its composite row ID for target mutations. Filter browser Network requests for ReportsTargets_getDataTable.
Related endpoints
ReportsTarget_newinitializes the twelve monthly rows.ReportsTargets_getDTsupplies the legacy positional table.