Saved views and configuration
List mapped filter preset rows
/a/UserFilters_getDataTable
Query filter presets as named-field objects for the CRM2 settings table.
When to use this endpoint
Use for CRM2 table display of own/public presets with selected fields, filtering and pagination.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. A tenant login is required.
Reads expose only filters owned by the current user or marked public=1. Writes require ownership or client-administrator permission; another user’s public filter is not editable merely because it is visible. Assigning or transferring ownership to another active tenant user requires client-administrator permission.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fields | Native array of strings | Yes | Selected mapped fields; unknown names ignored and id automatically included. A JSON-encoded string is not decoded. |
start / length / draw | Integer strings | No | Defaults start=0, length=10, draw=0. start must be nonnegative and length positive; no upper cap or -1 all-rows convention. draw must be an integer. |
isTable / limit | Integer strings | No | isTable=0 disables table paging/counts; limit then caps rows only if positive, otherwise unbounded. Default table mode ignores limit. |
orderBy / orderDesc | Strings | No | Provide both: mapped sort key and direction asc or desc (case-normalized). Other directions are rejected. |
order | Native DataTables array | No | Alternative first-entry column/dir sort. The column index is reduced by one, floored at zero, and selects from fields. Default is first recognized selected field ascending. No ID tie-breaker. |
searchValue / searchField | String / native array or string | No | Nonblank case-insensitive substring search, over All by default or specified mapped fields. SQL LIKE wildcards remain meaningful. |
groupBy | Native array of mapped names | No | Generic SQL grouping control. No aggregate fields are supplied here; avoid it for ordinary table pagination. Counts do not incorporate grouping. |
advanceSearch | Native array | No | Native list of structured rules: column (or id), condition, value, optional andOr=AND/OR and balanced special=(/) grouping. Operators: equal, notEqual, contains, greaterThan, greaterThanOrEqual, lesserThan, lesserThanOrEqual. Raw where clauses are rejected. |
Mapped field filters | Scalar or native array | No | Keys: id (integer), cDate (stored datetime), userID (integer owner), name (text, max 182 characters), data (JSON), public (integer), pageType (text), meta (JSON). Text scalars use substring matching, arrays membership; integer filters use equality/membership. |
referenceDate / dateFrom / dateTo | String / integer day offsets | No | Choose cDate to constrain creation dates inclusively from start of dateFrom day through end of dateTo day relative to tenant-local today. Both date offsets are required together. |
offsetFrom / offsetTo | Native objects | No | Reference-date adjustments with hour (negated by the helper) and minute values; parsing uses PHP server datetime handling. |
timeRangeFrom / timeRangeTo | Integer hours | No | With a reference date and timeRangeFrom, inclusive hour filtering uses tenant timezone (fallback Europe/London). timeRangeTo alone is ignored due to a duplicated condition check. |
Example request
$result = FM_api('UserFilters_getDataTable', [
'fields' => ['name', 'public', 'data'],
'userID' => '1042',
'start' => '0', 'length' => '25', 'draw' => '1',
]);
Example response
{"data":[{"name":"Northwind jobs","public":"0","data":"{\"searchValue\":\"Northwind\"}","id":"1088"}],"draw":1,"recordsTotal":"3","recordsFiltered":"1"}
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: fields"} | fields omitted. |
{"error":"error in database query"} | Primary query fails. |
{"error":"unsupported raw advanced search"} | A raw where rule was supplied. |
{"error":"missing or invalid parameter: orderDesc"} | An unsupported sort direction was supplied. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Mapped fields:
id(integer),cDate(stored datetime),userID(integer owner),name(text, max 182 characters),data(JSON),public(integer),pageType(text),meta(JSON). Object rows contain mapped aliases, not physical page_type/user_id names. JSON columns remain encoded strings. - Tenant timezone affects the relative-day anchor and hour conversion; SQL datetime rendering/parsing still depends on the server session. Use direct cDate filters/structured conditions for explicit dates.
- No write, cache marker or notification.
- Raw advanced-search SQL, unsafe directions, non-list field controls, nested filter values and malformed pagination/date-offset controls return structured errors before the query. Structured advanced-search grouping must be balanced.
- Only the current user’s own filters and public=1 filters are visible, including when an explicit ID is requested. Missing/private IDs are omitted; empty selectors never bypass this visibility predicate.
- recordsTotal counts the visible own/public set before request filters; recordsFiltered includes request filters. No automatic owner-activity restriction or stable ID tie-breaker is added.
See it in Fieldmotion
CRM1
No direct CRM1 caller for this mapped route was found. CRM1 Settings → Filters uses UserFilters_getDT, UserFilter_setName, UserFilter_setPublic and UserFilter_delete.
CRM2
Open CRM2 Settings → Filters. Its UserFilter/UserFilters widget prefixes resolve through shared detail/table/edit helpers; filter browser Network requests for this exact route.
Related endpoints
UserFilters_getDTuses the same own-or-public filtering and positional rows.UserFilter_getRequestedDetailsfetches selected rows without table counts/paging.