Customer tab: legacy Task APIs
Page tasks through the customer-tab alias
/a/CustomerTasks_getDataTable
Filter and page customer Tasks.
When to use this endpoint
Supply customer to select a customer’s Tasks. This namespace does not add that selection implicitly.
Authentication and permissions
Use signed API-key authentication or a logged-in CRM session. API keys act as their owner; session requests use dispatcher CSRF protection where configured. IDs and mapped queries address the authenticated tenant.
Login is required. CRM2 requests require Tasks View (pageTasksMain, with legacy pageTasks fallback). CRM2 TeamAccess scope applies to records and related data. These added CRM2 role/scope checks do not apply to CRM1 requests; CRM1 retains its legacy permission model. Tenant isolation and business validation apply to both clients.
For CRM2 non-admins, an explicit pageTasksMain_viewCreatedAndAssignedOnlyByUser restriction limits results to Tasks they created or are assigned. Otherwise absence of pageTasksMain_viewPrivateTasks restricts reads/writes to public Tasks. Creating a private Task or changing public to private requires pageTasksMain_setTaskPrivate. These privacy-role additions do not apply to CRM1.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id / ids | Positive integer or native/JSON-encoded list | Yes for updates; optional for reads | id takes precedence. Decimal integer strings are accepted and duplicates removed; invalid/nonpositive members reject the selection. Empty lists select no records. Omitted IDs on a read leave the other mapped filters in control. |
fields | Native list of mapped names | Required for tables; optional for details | Details default to all mapped fields. Unknown projection names are omitted and id is included. JSON-encoded fields text is rejected. |
Mapped filters / advanceSearch | Scalars, native lists or structured rules | No | Mapped filters combine with AND; lists use IN. Detail quoted scalars use trimmed case-insensitive exact matching; table quoted scalars use substring LIKE. Advanced rules require a mapped column/id, value and one of equal, notEqual, contains, greaterThan, greaterThanOrEqual, lesserThan, lesserThanOrEqual; andOr and balanced special parentheses are validated. Raw where fragments and nonempty groupBy are rejected. |
order / orderBy / orderDesc | Mapped names/descriptors or DataTables order | No | Use mapped names and asc/desc. Tables accept DataTables column/dir ordering or named orderBy/orderDesc, with main.id ascending as a stable tie-breaker. Detail order accepts mapped names or {id,dir} descriptors; no detail pagination is applied. |
start / length / draw | Integer-compatible | No | Table defaults are 0/10/0. start is a nonnegative offset, length must be positive, draw is echoed as an integer. length=-1 is rejected; no route-specific maximum is imposed. |
isTable / limit | Integer-compatible | No | Default table mode returns data, draw, recordsTotal and recordsFiltered. isTable=0 returns a data envelope without draw/counts; limit is a nonnegative unpaged cap (0 means uncapped). |
searchValue / searchField | Text / mapped name or native list | No | Nonblank text performs case-insensitive substring LIKE; searchField defaults All. SQL LIKE % and _ retain wildcard meaning. Joined reference fields search their configured labels. |
referenceDate / dateFrom / dateTo | Mapped date name / integer day offsets | No | With both bounds, select inclusive day boundaries relative to today in the account timezone (UTC fallback). Bounds are day offsets, not absolute dates. offsetFrom/offsetTo hour/minute objects adjust datetime boundaries; date-only fields ignore them. timeRangeFrom enables inclusive hour filtering, with timeRangeTo default 23; reversed hour bounds swap and the hour timezone defaults Europe/London. |
notesFilter | Text | No | Matches note-content LIKE before counting and pagination using EXISTS, so multiple matching notes do not duplicate a Task. Present blank matches Tasks with a note. Quotes are escaped; %/_ retain LIKE wildcard meaning. No match returns an ordinary empty result. |
Example request
$result = FM_api('CustomerTasks_getDataTable', ['fields'=>['id','subject','customer'],'customer'=>'1042','start'=>'0','length'=>'10']);
Example response
{
"data": [
{
"id": "18",
"subject": "Arrange service",
"customer": "1042",
"linkedJobs": []
}
],
"draw": 0,
"recordsTotal": "12",
"recordsFiltered": "1"
}
Scalar numeric values may be strings or numbers depending on the database driver.
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 is not a native list, or is absent in table mode. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Details return a bare row array; plural table routes return a data envelope (draw/counts are omitted with isTable=0). Empty selections produce []/empty data. Database scalar types remain driver-dependent; whole JSON/text columns remain encoded strings. Counts respect the same CRM2 visibility boundary as the data; recordsFiltered includes the request filters.
- Each row retains linkedJobs: an array of {jobID,jobRef} from active type-8 Job links, ordered by integer Job ID and constrained by CRM2 Job scope only for CRM2. No customer filter is implicit; supply customer deliberately.
- No direct caller of this exact namespace was found in the current mobile intermediary/app sources; mobile synchronization uses separate APIs.
Side effects
- Reads only; no record, membership, queue or notification changes.
See it in Fieldmotion
CRM1
In CRM1, open Customers > a record > Tasks. The current screen calls Customer_getEventsDT and links to the canonical Task editor; no direct current call to this CustomerTask alias was found.
CRM2
In CRM2, open Customers > a record > Tasks. pageCustomerTasks passes its customer filter to shared moduleTasks, which selects Task/Tasks API prefixes. No direct current call to this legacy CustomerTask alias was found; inspect canonical Task/Tasks requests for the current UI workflow.
Related endpoints
CustomerTask_createData— Understand customer association and assignee mail.CustomerTask_getRequestedDetails— Inspect Task IDs and Job links.CustomerTask_updateData— Patch a Task without creation-only normalization.