When to use this endpoint

Use JobType_updateData for CRM2’s configurable Job Types edits, including its bulk archive actions. Focused JobType_set* routes preserve CRM1-specific validation and response behavior.

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 string or native arrayYesTarget ID or an already-decoded array of IDs. Scalar mode returns row-specific warnings. Array mode processes sequentially, discards every per-row result, and returns {"ok":1}.
nameStringNoComplete replacement name. Blank, whitespace-only, duplicate, and arbitrarily long values are accepted.
priorityInteger stringNoDefault priority after integer conversion. The tenant priority choices are not checked.
notesStringNoComplete replacement notes. CRM2 submits encoded note-list text; valid note objects containing @username can create in-CRM mention notices.
metaString or JSON-compatible valueNoComplete metadata replacement. Named meta* values in the same request are merged later and take precedence for their keys.
archivedInteger stringNoArchive value after integer conversion. CRM uses 0/1, but other integers are accepted.
nominalCodeStringNoComplete nominal-code replacement without account or length validation.
taxSettingsString or JSON-compatible valueNoComplete tax-settings replacement. Arrays/objects are JSON-encoded, strings are stored verbatim, and blank string becomes SQL null.
departmentInteger stringNoDefault department after integer conversion. Existence is not checked.
metaFormIDStringNoReplaces meta.form_id without verifying the form.
metaSendNotificationStringNoReplaces meta.send_notification without restricting it to 0, 1, or 2.
metaNotificationEmailStringNoReplaces meta.notification_email without email validation.
metaOrderNumInteger stringNoReplaces meta.orderNum after integer conversion. Unlike creation, omission does not supply a default.
lastEditedDatetime stringNoAccepted by the map, but any changed update appends current server time after mapped values, so the supplied timestamp does not survive.
noRecordNative arrayNoMapped keys whose generic audit entries should be marked hidden. It does not suppress the writes or mention notices.

Example request

$result = FM_api('JobType_updateData', [
	'id' => '42',
	'name' => 'Emergency repair',
	'priority' => '4',
	'metaFormID' => '18',
]);

Example response

{
  "ok": 1
}

Scalar no-op input returns {"warning":"No Change."}; a missing row returns {"warning":"No data."}; only unknown update keys return {"warning":"no updated fields."}. Supplying only id returns {"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 key is absent.

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

Behaviour and edge cases

  • Unknown request keys are ignored. UI readonly flags are not API write protection, and the focused setters’ type/form/department/email/priority validation is not repeated.
  • Named metadata fields preserve unrelated keys when existing/full metadata is valid JSON; otherwise the relevant metadata is rebuilt as an object.
  • Every changed scalar row receives current last_edited. A supplied lastEdited can appear in audit comparison even though current time is ultimately stored.
  • There is no filtering or pagination beyond explicit target IDs.

Side effects

  • Changed rows advance the job-type cache marker and receive generic audit entries for each changed mapped field.
  • Encoded notes are scanned for mentions after any non-error response. Matching usernames can receive an in-CRM notice linked to the Job Types page.
  • Existing jobs and invoices are not rewritten when their type defaults change.

See it in Fieldmotion

CRM1

A production-source search found no direct CRM1 caller. CRM1 uses the focused setters on its Job Types table.

CRM2

Open Settings → Job Types and edit ordinary mapped fields or use bulk Archive/Unarchive. The shared module derives this endpoint from its API prefix.

Related endpoints