When to use this endpoint

Use JobType_setPriority for CRM1’s Job Types priority cell. CRM2 normally saves mapped field priority through JobType_updateData.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.

The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesExisting positive job-type ID.
priorityInteger stringYesZero-based choice index after integer conversion. Negative and out-of-range indexes are rejected; blank or nonnumeric text becomes index 0.

Example request

$result = FM_api('JobType_setPriority', [
	'id' => '42',
	'priority' => '4',
]);

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"}The ID is absent or integer-converts below one.
{"error":"missing or invalid parameter: priority"}The priority key is absent or null.
{"error":"job type does not exist"}No type matches the ID.
{"error":"invalid parameter: priority"}The index is negative or has no configured label.

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

Behaviour and edge cases

  • The exact tenant setting appointment-priorities supplies newline-separated labels when nonblank; index 0 is prepended as the blank choice. Without it, indexes 0–5 map to blank, None, Low, Normal, High, and Top.
  • An equal integer value is a no-op. CRM1 applies the priority whenever the type changes; CRM2 applies it only when the job priority is empty.
  • Existing jobs keep their current priority.

Side effects

  • On change, updates priority and last_edited and advances the job-type cache marker.
  • This focused setter writes no generic field-level audit entry.

See it in Fieldmotion

CRM1

Open Settings → Job Types and edit Priority. CRM1 builds the selector from the tenant choices and calls this route.

CRM2

CRM2’s Job Types module uses the mapped update route; that route does not repeat this tenant-choice validation.

Related endpoints