When to use this endpoint

Use MarketingSources_getDataTable when reproducing CRM2’s Marketing Lead Source screen. For ordinary selector options, use MarketingSources_list.

Authentication and permissions

This shared CRM2 table wrapper is intended for signed API-key requests or logged-in CRM sessions, so the request has an authenticated tenant database.

The wrapper omits the normal login guard and has no page or role-permission check. Without tenant context it can reach the wrong database prefix and return a database-query error instead of a structured authentication error.

Parameters

ParameterTypeRequiredDescription
fieldsNative arrayYesMapped fields from id, name, createDate, and lastEdited. Unknown names are skipped and id is always added.
isTableInteger stringNoDefaults to table mode. Exact integer 0 returns only data and allows optional limit.
draw, start, lengthInteger stringsNoTable counter, offset, and page size. Defaults are 0, 0, and 10.
limitInteger stringNoPositive non-table row limit; zero means no limit.
orderBy / orderDescMapped field / directionNoExplicit sort. CRM callers use asc or desc.
order[0][column] / order[0][dir]Integer / stringNoDataTables ordering fallback with the shared leading-action-column offset.
searchValue / searchFieldString / field or native arrayNoCase-insensitive substring search across one mapped field or All.
name, createDate, lastEdited, idScalar or native arrayNoMapped filters. Name scalars use case-insensitive substring matching; numeric fields use equality; arrays use IN.
referenceDate, dateFrom, dateToMapped field and integer offsetsNoShared relative-date filter in the tenant timezone; both offsets are needed.

Example request

$table = FM_api('MarketingSources_getDataTable', [
	'fields' => ['id', 'name', 'createDate'],
	'draw' => '4',
	'start' => '0',
	'length' => '25',
	'searchValue' => 'trade',
	'orderBy' => 'name',
	'orderDesc' => 'asc',
]);

Example response

{
  "data": [{"id":"30124","name":"Trade show","createDate":"2026-10-01 15:05:00"}],
  "draw": 4,
  "recordsTotal": "12",
  "recordsFiltered": "1"
}

Errors and unusual responses

ResponseCondition
{"error":"missing or invalid parameter: fields"}fields is absent.
{"error":"error in database query"}A generated mapped query fails.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Table mode returns data, integer draw, and scalar counts. Non-table mode returns only data.
  • createDate and lastEdited are formatted from stored Unix timestamps.
  • The table has no active/deleted filter. Counts include every stored source.
  • Unknown fields and malformed advanced-search items are silently ignored.

See it in Fieldmotion

CRM1

CRM1 uses MarketingSources_getDT.

CRM2

Open Marketing → Marketing Lead Source in CRM2 and filter browser developer tools for the exact function name. The shared display widget derives this route and sends its columns, filters, sorting, and pagination.

Related endpoints