When to use this endpoint

Use after link changes or to refresh the quote’s derived has_jobs value. The result is an account-level active Job count, without per-Job visibility filtering.

Authentication and permissions

Authenticates a signed API key or CRM session as its tenant user. Requires Quotes View (pageQuotes_view). Non-admin users blocked by legacy crm_access bit 32 are denied. Roleless non-admin users fail closed. Client administrators inherit page permissions.

Uses local tenant IDs. No additional Quote owner/department predicate is applied; these endpoints do not return a visibility-filtered Job list.

Parameters

ParameterTypeRequiredDescription
idPositive integer-compatible quote IDYesPositive local quote ID, integer-converted; an active quote is required.
updatePresence switchNoAny present/non-null value, including 0 or blank, writes quotes.has_jobs. Omit it for read-only behavior; it is not a truthy boolean switch.

Example request

$links = FM_api('Quote_countLinkedJobs', ['id'=>'1042']);

Example response

{"ok":1,"jobs":2}

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":"quote does not exist"}The active quote is missing (lookup failures are reported separately).
{"error":"permission denied"}Required Quotes permission is absent or the non-admin actor is blocked by legacy access settings.
{"error":"missing or invalid parameter: id","jobs":0}Missing/nonpositive quote ID.

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

Behaviour and edge cases

  • Requires a non-deleted quote and counts distinct existing non-deleted Jobs joined through manymany type_num=2, from_id=Job and to_id=quote. Duplicate edges, stale IDs and deleted Jobs do not count.
  • Present/non-null update, including 0 or blank, refreshes has_jobs with a checked write under the quote lock. This is a derived cache refresh permitted to Quotes View users and used by outer list/detail reads.
  • No last_edited, history, messages or link creation/removal. Quotes cache invalidation is requested on refresh. Missing quotes and failed reads/writes return errors rather than zero success. No ordering or pagination applies.
  • No direct mobile app/m-service caller for this RPC was found.

Side effects

  • With update present, refreshes has_jobs and requests quotes cache invalidation. No last_edited, history, messages or relation changes.

See it in Fieldmotion

CRM1

No direct browser Quote_countLinkedJobs call found. Job_quoteLink calls it with update=1; legacy Quotes_getDT can also refresh cached has_jobs internally.

CRM2

No direct browser RPC found. Quotes_getDataTable and Quote_getRequestedDetails can invoke it internally with update=1 when resolving hasJobs, so an outer read can update the cached count.

Related endpoints