When to use this endpoint

Replace one saved priority code, with legacy zero and no-change responses.

Read the target job first with Jobs_getSome to obtain the current values and confirm the IDs belong to the intended account.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. The request uses the authenticated account’s job IDs, not mobile app IDs.

No extra page, role, assignee, department or client-administrator check is applied by this handler.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPhysical job ID in the authenticated account, converted with intval; must be positive.
valueInteger stringYesRequired present value, converted with intval. Zero/nonnumeric input produces a no-write warning. Any nonzero integer, including negative or unknown codes, is accepted without looking up the configured priority list.

Example request

$result = FM_api('Job_setPriority', ['id'=>'1042', 'value'=>'2']);

Example response

{"ok":1}

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":"missing or invalid parameter: id"}id is absent or converts to a nonpositive integer.
{"error":"missing or invalid parameter: value"}value is absent or null.
{"error":"job does not exist"}The active job read fails or has no row.
{"error":"value already set"}The current priority equals the converted nonzero value.
{"ok":1,"warning":"no value provided"}value converts to zero; the job is not looked up.
{"error":"Unable to save job"}The primary database write failed. History and dependent effects are not performed for that failed save.
{"ok":1,"warning":"Job saved, but the outsourced copy could not be updated"}The local save committed but an outsourced read/write failed. Do not repeat the local mutation blindly.

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

Behaviour and edge cases

  • Reads an active job only after rejecting zero with a warning. Equality is returned as an error, not a success warning.
  • This is a priority edit, not a completion/substatus change, and it does not run Workflow actions.
  • The primary UPDATE is checked before history and dependent effects. There is no transaction combining this field write with later cross-object effects; inspect committed-success warnings before retrying.

Side effects

  • Writes last_edited and edited_uuid with the changed fields and invalidates the meetings cache.
  • Records a job history entry. No mail is sent directly by this setter.
  • Mirrors the priority and edit markers to a linked outsourced job. A failed destination write returns committed success with a warning and has no deleted-row filter.

See it in Fieldmotion

CRM1

On Jobs list click the Priority cell and select a new priority; pageJobs.js sends Job_setPriority. Full legacy job edits also invoke it through Job_save.

CRM2

No direct CRM2 caller was found in the canonical/legacy route search. CRM2’s layout-driven updates are a separate contract.

Related endpoints

  • Jobs_setPriority accepts a batch and has different zero-value behavior.
  • Jobs_getSome reads selected job records before editing and verifies the stored result afterward.