Form definitions, recorded responses and exports
Page recorded Job Table answers
/a/Form_tableDataGetDT
Expand a page of matching Jobs into their recorded rows for one linked Job Table.
When to use this endpoint
Use the legacy Table Data report. Pagination selects Jobs before expanding their table answers, so the returned data length is not a DataTables row page size.
Authentication and permissions
Authenticate with a signed API key (acting as its owner) or a logged-in CRM session on the routed account host. Session calls include the dispatcher’s CSRF value when configured. IDs refer to the authenticated tenant unless an explicit cross-account copy is described.
Requires login. No Report Form Data role check or Job record-scope predicate is added by this handler/its Form dispatch prefix.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
table_id | Integer-compatible ID | Yes | Linked Table Form ID, not its parent Job Form ID. Presence is checked, but positive/existing/type validation is not. |
daysFrom, daysTo | Integer-compatible signed day offsets | Yes | Relative to the server calendar’s today, then converted through account-local date handling. Includes daysFrom midnight through the whole daysTo date; negative values select past dates. |
job_id | Integer-compatible ID | No | Positive exact Job ID. |
job_ref | Text | No | Case-insensitive reference substring. |
department_id | Integer-compatible ID | No | Positive exact Job department only; unlike dataGetDT it does not include assignee/Customer department matches. |
start, length | Integer-compatible values | No | SQL Job offset and Job page length. See endpoint defaults; these are not expanded table-row offsets. |
draw | Integer-compatible value | No | DataTables draw counter echoed as an integer; send 0 when not using DataTables. |
user_id, customer_id | Integer-compatible IDs | No | Nonzero exact assignee/customer_id filters. customer_id alone does not constrain customer_type. |
customer_asset | Text | No | Case-insensitive Customer name or Asset name/code substring. Blank disables it. |
parent_id | Positive integer-compatible ID | No | Only ordinary Customer Jobs: current customer_id equals the parent ID or saved customer_details.parent_id equals it. Asset Jobs are excluded when set. |
search[value] | Text | No | DataTables nested search string. Search behavior differs between the grids; see below. |
order | Native nested array | No | Only order[0][column] and order[0][dir] are used. Exact asc is ascending; otherwise descending. No supplied order means no SQL ordering. |
Example request
$rows = FM_api('Form_tableDataGetDT', [
'table_id'=>'1043','daysFrom'=>'-30','daysTo'=>'0',
'start'=>'0','length'=>'10','draw'=>'1',
'order'=>[['column'=>'4','dir'=>'asc']],
]);
Example response
{"draw":1,"data":[["2081","JOB-2081",["1088","Alex","0"],["0","1045","Northwind"],"2026-11-26 09:00:00","Checked"]],"recordsTotal":"1","recordsFiltered":"1"}
Database numeric values can be JSON strings. Examples are representative; legacy application errors can use HTTP 200, so inspect the decoded response.
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: table_id"} | table_id absent. |
{"error":"missing parameter: daysFrom"} | Lower offset absent. |
{"error":"missing parameter: daysTo"} | Upper offset absent. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Defaults start=0 and length=10. SQL limits Jobs, then emits every saved row from subform_values[table_id]. Both count fields equal the filtered Job count, not the number of emitted table rows. A page of ten Jobs can return zero or hundreds of rows.
- Matches nondeleted Jobs with a serialized table-key substring and scheduled epoch >= daysFrom midnight and < midnight after daysTo. No completion/status restriction or parent form_id restriction is added.
- Each data row is [jobID,job_ref,[userID,userName,userParent],[customer_type,customerID,name],local scheduled datetime,...table cells]. Short cell lists are padded to the current table field count; extra stored cells beyond that count are omitted. Values, including multi-select/calculation values, are returned raw for client formatting.
- Search matches exact lowercased job_ref, Customer/Asset name substrings, assignee names or the entire serialized subform_values document. It can therefore match answers belonging to another linked table in the same Job.
- Order columns: 0 Job ID, 1 reference, 2 assignee name, 3 Customer name, 4 scheduled epoch; other indexes use reference. No secondary stable order. customer_asset is a separate Customer name/Asset name/code substring filter.
- Customer/Asset display enrichment uses the correct table and a type-plus-ID cache key. Numeric IDs can overlap across entity types; retain customer_type with customerID when identifying the record.
Side effects
- Reads only; no table answers or definitions are altered.
See it in Fieldmotion
CRM1
Open Reports → Table Data, choose a table, set relative dates and page/search. Filter Form_tableDataGetDT; the date pickers serialize signed day offsets, not absolute dates.
CRM2
No direct CRM2 caller found for this legacy grid. For a Form report download including tables, inspect Form_exportDataAsCSVWithSubforms.
Related endpoints
Form_exportTableData— download a table’s rows across its single parent form.Form_exportDataAsCSVWithSubforms— export main and table answers together.