Forms
List form question names
/a/Forms_getFieldNamesByIds
Return compact form/question descriptors for export-field and reporting selectors.
When to use this endpoint
Use this to build a selectable question list for one or more forms. Set include-subforms=1 when the selector must also expose directly linked Job Table fields.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session and is scoped to the authenticated tenant.
The handler performs no form, department, owner, or page-permission check unless the page below says otherwise. CRM navigation may impose additional UI-only access rules.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | JSON array string | No | Positive IDs. Missing or empty-array input falls back to all Job and Job Table forms, or to the supplied type. Native arrays are not supported. |
type | Integer-compatible | No | Used only when no positive IDs remain. Without it, types 0 and 3 are selected. |
no-archived | Boolean-compatible integer | No | Exact integer 1 excludes archived rows. |
include-subforms | Boolean-compatible integer | No | Exact integer 1 follows direct subform fields from the selected forms and adds their referenced form IDs. It does not recursively traverse deeper tables. |
Example request
$fields = FM_api('Forms_getFieldNamesByIds', [
'ids' => json_encode([1042]),
'include-subforms' => '1',
'no-archived' => '1',
]);
Example response
[["1042", "Service visit", [["Result", "input", "1586980384132"], ["Parts", "subform", "1586980384133"]]]]
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":"ids must be an array of integers in JSON form"} | The supplied value is malformed JSON or does not decode to an array. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Each form row is
[formId, formName, fields]; each field is[name, type, stableFieldId]. Missing field properties become empty strings. - Forms with malformed non-array
fieldsJSON are omitted. - The direct-table deduplication check compares a referenced ID with array indexes rather than existing values. Duplicate form rows are still collapsed by the final SQL
IN, but the intermediate list may contain repeated IDs. - No ordering is specified.
See it in Fieldmotion
CRM1
Job, Quote, Invoice, Opportunity, and report exports use this endpoint to assemble selectable question columns.
CRM2
The corresponding export widgets and Report Table Data page use it.
Related endpoints
Forms_getTablesByIdsreturns complete linked table definitions.Forms_getByIdreturns complete selected form columns.