When to use this endpoint

Compare numeric Job completion states across separately selected grouping and filtering dates. Select the matching saved Reports dashboard chart or table, choose a bounded range, and use the returned series to render that report.

res contains an optional overall series, numeric completion-state series and unused zero rows; type="custom", xLabels and xLabels1 are returned.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. The handler requires login and account reporting feature bit 8192. No separate Reports, Jobs, Tasks or finance page-permission check is added by the handler.

The dispatcher rejects this legacy Report route for configured TeamAccess record scope, including assigned-only/parent-manager access and applicable department hierarchy scope. It returns an explicit scope error rather than a silently filtered chart.

Allowed requests read the authenticated tenant. Entity selections are report filters or label controls, not authorization; the handler does not add customer account-manager ownership filtering.

Parameters

ParameterTypeRequiredDescription
daysFromInteger stringYesInclusive first date: relative day offset from current PHP time by default, or Unix seconds with durationType=1. Must be an integer; malformed/blank values are rejected. ISO strings are not parsed as dates.
daysToInteger stringYesInclusive last date, in the same mode as daysFrom. Expanded to 23:59:59 in the account timezone; no reversed-range validation.
durationTypeInteger stringNoDefault 0. Exactly 1 uses Unix seconds; other values convert integer day offsets through strtotime. Use 0/1; numeric values are validated before report SQL.
frequencyInteger stringNoDefault 0 monthly, 1 weekly, 2 quarterly, 3 yearly. Controls helper axis and grouping, using ISO week-year for weekly periods. Unsupported values are rejected.
userTypeInteger stringYes0 summary, 1 users, 2 customers, 3 asset-axis labels. User grouping is created_by for Invoices and assigned user_id for Jobs. Type 3 uses the same customer-key grouping as type 2 rather than an actual asset relationship.
userNative array of ID strings or ["All"]NoDefaults to ["All"]; a supplied empty list is rejected. Summary ignores the selection; individual axes include selected IDs by name. Pass a native array, not an encoded JSON string.
displayTypeInteger stringYes0 count; 1 linked Job value. Other values fall back to count. Monetary aggregates are integer-converted; this is not a precise ledger export.
legendNative array of stringsYesNumeric is_complete states, optionally Opportunity for overall activity. This is not the separate user_status field. Native list shape and token values are validated before SQL; encoded JSON strings are rejected.
dateGroupInteger stringNoDefault 0 scheduled meeting_time_e, 1 cdate, 2 due_date, 3 date_completed. Selects the grouping column. Scheduled mode uses Unix comparison/grouping; datetime fields use the date path. Unsupported IDs are rejected.
dateRangeInteger stringNoDefault 0 scheduled meeting_time_e, 1 cdate, 2 due_date, 3 date_completed. Selects the filtering column. Scheduled mode uses Unix comparison/grouping; datetime fields use the date path. Unsupported IDs are rejected.

Example request

$report = FM_api('Report_getJobsStatusUser', [
	'daysFrom'=>'1768003200',
	'daysTo'=>'1768003200',
	'durationType'=>'1',
	'userType'=>'0',
	'frequency'=>'0',
	'displayType'=>'0',
	'user'=>['All'],
	'legend'=>['1'],
]);

Example response

{
  "type": "custom",
  "res": [
    [
      0
    ],
    [
      0
    ]
  ],
  "xLabels": [
    "Jan 2026"
  ],
  "xLabels1": []
}

Representative empty-cohort result from the real handler with a January 2026 summary axis. The request timestamp is 2026-01-10 00:00:00 UTC and expands to account-local day boundaries.

res contains an optional overall series, numeric completion-state series and unused zero rows; type="custom", xLabels and xLabels1 are returned.

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":"This legacy report does not support your configured record scope. Use the scoped Contracts reports or table exports."}The dispatcher detects configured TeamAccess record scope before the handler.
{"error":"no permission to access api"}Account reporting feature bit 8192 is absent.
{"error":"missing parameter: daysFrom"}The named parameter is omitted or null. Present blank/malformed controls return an invalid-parameter error instead; list controls must be native arrays.
{"error":"missing parameter: daysTo"}The named parameter is omitted or null. Present blank/malformed controls return an invalid-parameter error instead; list controls must be native arrays.
{"error":"missing parameter: userType"}The named parameter is omitted or null. Present blank/malformed controls return an invalid-parameter error instead; list controls must be native arrays.
{"error":"missing parameter: displayType"}The named parameter is omitted or null. Present blank/malformed controls return an invalid-parameter error instead; list controls must be native arrays.
{"error":"missing parameter: legend"}The named parameter is omitted or null. Present blank/malformed controls return an invalid-parameter error instead; list controls must be native arrays.
{"error":"invalid parameter: legend"}A supplied numeric/list control is malformed, a list contains unsupported tokens, or frequency/userType/date selectors are outside 0–3. The message names the invalid control; validation precedes chart queries.

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

Behaviour and edge cases

  • Numeric legend entries filter is_complete, not user_status. The exact Opportunity token adds a separate all-completion-state aggregate; no opportunities table is read.
  • dateGroup chooses the SQL grouping column and dateRange the SQL filtering column independently. Both default to scheduled meeting_time_e; alternatives are cdate, due_date and date_completed.
  • Grouping and filtering follow their selected storage types independently: meeting_time_e uses FROM_UNIXTIME and epoch comparisons, while cdate/due_date/date_completed use date/datetime comparisons and grouping.
  • Jobs must be active and the selected range field non-null. Changing dateGroup without dateRange can put a matching Job in an unrepresented output period, which is then silently dropped.
  • The series allocator leaves one extra zero row for numeric-only legends and two extra rows for overall plus numeric states. Overall alone produces a single row; empty numeric-only legend allocates one zero row without a status query.
  • PHP timezone is saved and restored on normal return paths for every durationType, including legacy integer offset modes above 1.
  • Linked Job value is computed once per Job: sum the net values of distinct type-3 linked Invoice IDs; if that sum is null, sum distinct type-2 linked Quote IDs; if null, use guarded meta.job_value, otherwise zero. Equal-valued documents remain separate contributions; duplicate links do not multiply values. An explicit zero sum stops fallback. No new deleted-finance filter or direct-link relationship is introduced, and current Job price_net is not used.
  • There is no pagination, checkpoint or result-size limit. Keep the date range and entity selection bounded. Aggregated values are numeric chart cells, not database scalar strings or object rows.
  • The helper orders periods first, then entities by name; one entity collapses xLabels to period text with empty xLabels1. Temporary users with non-null meta.is_tmp are excluded from user-axis lookups, but inactive/deleted label entities are not generally excluded. Unmatched entity/date keys are silently dropped.
  • PHP date conversion uses the account timezone (missing/null defaults to Europe/Dublin, blank means UTC). SQL date/Unix conversion uses its database session timezone; these handlers do not force cross-layer alignment.
  • Weekly axes enumerate real Mondays and use ISO week-year keys consistently with SQL. Week 53 and ranges crossing a calendar-year boundary are included; display labels are Week NN YYYY using the ISO year.
  • Numeric controls and native selector lists are validated through Report_validateChartRequest before SQL. JSON-encoded list strings, nested/object-keyed arrays, unsafe ID values and undocumented tokens are rejected. The existing login, reporting-feature and TeamAccess entry policies remain unchanged.
  • No direct caller for this endpoint was found in the mobile app or its m-service intermediary.

Side effects

  • Reads tenant data only; no business-record, audit, notification or schema writes occur. The chart restores its temporary PHP timezone on normal return paths.

See it in Fieldmotion

CRM1

Open Reports dashboard, add or preview Job Status, choose filters and inspect Network for Report_getJobsStatusUser. pageReportDashboard.js constructs the endpoint dynamically from the saved api value. Generic legends can control presentation without changing the backend cohort; compare the actual request with this page’s parameter contract.

CRM2

Open Reports dashboard, add or preview Job Status, choose filters and inspect Network for Report_getJobsStatusUser. lib/displayReport.js / pageReportDashboardDetails.js constructs the endpoint dynamically from the saved api value. Generic legends can control presentation without changing the backend cohort; compare the actual request with this page’s parameter contract.

Related endpoints