When to use this endpoint

Use as the Operations worklist, including finding queue IDs and uncertain receipts that need review. It reads persisted states and does not contact the provider.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session; session dispatch applies CSRF checks. The authenticated tenant must have features2.ukDigitalWasteManagement=1. The feature is read from the account record, not trusted from request input.

Requires Jobs View through Core_requirePermission('view', 'pageJobs').

Job reads and mutations enforce the authenticated tenant, active Job, TeamAccess department/assignment scope and the legacy department-based customer boundary. Collections filter before counts/pagination; explicit Job and cancellation requests check access before a service call or queue mutation.

Parameters

ParameterTypeRequiredDescription
job_idInteger-compatibleNoNonempty filters one Job ID. In table mode, a nonempty scalar id also supplies job_id.
from, toDate-compatible stringsNoCompletion date bounds; strtotime normalization yields inclusive 00:00:00 through 23:59:59 in PHP/server timezone. Invalid strings are not rejected explicitly.
status, profile_idStrings; table filters can be native arraysNoPlain mode exact filters are applied before slicing. Table mode applies the common exact field filters and presentation search.
page, limitInteger-compatibleNo in plain modeOne-based page defaults 1; limit defaults 50 and is clamped 1–100. Not the CRM2 table pagination contract.
isTableTruthy valueNoNonempty switches to the table envelope and common start/length/search/order controls. String "false" is nonempty and enables it.
referenceDate, dateFrom, dateToString / integer day offsetsNo in table modeOnly referenceDate=date_completed translates numeric dateFrom/dateTo into relative calendar-day bounds. Other referenceDate values add no relative-date filter.
start, length, drawInteger-compatibleNoOffset (default 0), page size (default 10, clamped 1–500) and echoed draw (default 0). This is not page/limit pagination.
searchValue, searchFieldStringsNoCase-insensitive substring search. searchField defaults to All; unsupported field names normally match no nonblank search.
orderBy, orderDescStringsNoSort by a returned property; only a case-insensitive desc value reverses the default ascending natural string comparison.

Example request

$result = FM_api('DigitalWasteTracking_operations', [
	'page'=>'1',
	'limit'=>'50',
	'status'=>'ready',
]);

Example response

{
  "ok": 1,
  "page": 1,
  "limit": 50,
  "total": 1,
  "rows": [
    {
      "id": 1042,
      "job_id": 1042,
      "job_ref": "DWT-1042",
      "date_completed": "2026-10-20 12:00:00",
      "form_name": "Synthetic receipt",
      "status": "ready",
      "profile_id": "aaaaaaaaaaaaaaaa",
      "profile_name": "North receiving site",
      "tracking_id": "",
      "event_at": 0,
      "queue_id": 0
    }
  ]
}

Errors and unusual responses

ResponseCondition
{"error":"not logged in"}No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs.
{"error":"UK Digital Waste Tracking is not enabled for this account"}The account feature is disabled.
{"error":"permission denied"}The required page action is absent; the shared permission helper retains its legacy roleless fallback.

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

Behaviour and edge cases

  • Includes non-deleted Jobs with is_complete in (1,2), joined to a Form whose JSON digital_waste_tracking.enabled equals 1. It does not exclude archived Forms and does not list incomplete/custom completed-status Jobs. The SQL reads all eligible rows before in-memory enrichment/filtering/pagination; page size is not a database scan limit.
  • Loads the latest receipt mapping and latest DWT log by ascending ID overwrite, plus a pending/running non-deleted type-102 queue row. Profile identity follows receipt/ambiguity history first, otherwise Job override/Form/account default. Missing names use Archived receiving site.
  • Derived status is queued, ambiguous, submitted, updated, validation_failed, terminal_failure, payment_required, setup_required or ready. Ambiguity takes precedence over queue presence. With no queue, payment errors override the mapped status; setup/notice errors classify unmapped Jobs. This is a local log heuristic, not a fresh provider reconciliation.
  • event_at is mapping cdate if a mapping exists, otherwise latest DWT log cdate, otherwise 0; it is not the queue due/claim time. queue_id is 0 when no active queue row was found. tracking_id is stored local mapping text.
  • Plain mode returns {ok,page,limit,total,rows}; total is after exact status/profile filters, and rows default to descending Job ID. If the initial eligible SQL set is empty, the early result is {ok,page,rows:[]} without limit/total. A later filter yielding no matches still returns limit/total.
  • For array-backed tables, start defaults to 0 and is clamped to at least 0; length defaults to 10 and is clamped to 1–500 (length=-1 means 1, not all). draw is integer-converted. searchValue is HTML-entity-decoded, trimmed and matched as a case-insensitive substring; searchField=All searches the listed searchable columns. Exact field filters accept one value or a native array of values, combine with AND, and ignore blank/empty lists. orderBy names an actual row property; orderDesc=desc reverses a natural, case-insensitive string comparison. Unknown sort names preserve source order. Counts are before and after these in-memory filters.
  • Table searchable/exact-filter columns are id, job_id, job_ref, form_name, status, profile_id, profile_name and tracking_id. date_completed/event_at/queue_id are not common exact filters. recordsTotal is after initial SQL/date selection but before in-memory presentation filters.

See it in Fieldmotion

CRM1

No direct CRM1 caller was found in the production JavaScript source. The operator workflow is implemented in CRM2.

CRM2

Open Digital Waste Tracking > Operations. The widget uses DigitalWasteTracking_operations with isTable, offset/page size, column filters and optional completion-date controls. This differs from the plain page/limit example.

Related endpoints