When to use this endpoint

Read the account’s reference-numbering basis before suggesting or displaying the next job reference.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. These calls use the authenticated account’s data; the handler has no additional job-page, department, assignee or client-admin permission check unless stated below.

Parameters

This endpoint has no operation-specific parameters.

Example request

$last = FM_api('Jobs_getJobRefLast');

Example response

"JOB-0042"

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.
falseNo matching stored reference exists for a database-backed branch, or its 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

  • job-ref-method='1' selects the largest nonblank active job reference ordered by job_ref_len descending, then job_ref descending. This is stored-length/lexical ordering, not numeric parsing.
  • job-ref-method='2' returns the empty string without querying jobs.
  • Other values select the nonblank reference from the most recently created active job whose meta.recurrence_previous_id is null, ordered by cdate descending then id descending. This checks the metadata key, not the separate recurrence_previous_id column.
  • Legacy invalid JSON is treated as a missing key by Core_sqlJsonExtract; it is not rewritten. All branches are read-only and unpaginated. A reference is not reserved.

See it in Fieldmotion

CRM1

Open the job create/edit dialog. jobEdit.js requests Jobs_getJobRefLast to show the current numbering basis; its automatic-reference flow also calls Jobs_getJobRefNext.

CRM2

No direct CRM2 caller was found in the reviewed source. For batched job fields, see Jobs_getById.

Related endpoints