When to use this endpoint

Use JobType_setName only when reproducing CRM1’s focused rename. CRM2 normally uses 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
idCanonical decimal integer stringYesPositive job-type ID. Send digits only; this legacy handler validates an integer conversion but later uses the original text in its update condition.
nameStringYesReplacement name. It is stored verbatim without trimming, length validation, or uniqueness checks. Empty string and "0" are rejected by PHP truthiness.

Example request

$result = FM_api('JobType_setName', [
	'id' => '42',
	'name' => 'Emergency repair',
]);

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 key is absent or its integer conversion is below one.
{"error":"missing or invalid parameter: name"}The name key is absent or null.
{"error":"no Job Type name supplied"}The supplied name is falsey, including empty string or "0".

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 handler does not load the row first. A missing positive ID returns success, as does writing the same name.
  • Whitespace-only names are accepted because the value is not trimmed.
  • Jobs reference the type ID, so existing jobs display the replacement name without being rewritten.

Side effects

  • Issues the name update, advances last_edited for matched rows, and advances the job-type cache marker.
  • This focused legacy setter writes no generic field-level audit entry.

See it in Fieldmotion

CRM1

Open Settings → Job Types and edit the Name cell. CRM1 calls this route on blur.

CRM2

CRM2’s Job Types editor saves the mapped name field through JobType_updateData.

Related endpoints

  • JobType_updateData normalizes the ID before its mapped update and records an audit entry.
  • JobType_new trims names and reuses an exact-name row during creation.