When to use this endpoint

Resolve the exact tenant label IDs first, send the name edit, then read back the selected rows. All selected IDs are validated and locked before any edit; an invalid/missing batch member aborts the entire transaction.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. The handler requires login but does not check a settings-page permission, role or record owner. All rows in this family belong to the authenticated tenant’s opportunity_statuses table.

Parameters

ParameterTypeRequiredDescription
id / idsPositive integer string or nonempty native arrayYesid takes precedence; ids is also accepted by the shared updater. IDs are validated, deduplicated and sorted for locking. Zero, negative, malformed and empty lists are rejected.
valStringYesTrimmed, nonblank name, at most 100 Unicode characters.

Example request

$result = FM_api('OpportunityStatus_setName', ['id' => '1042', 'val' => 'Negotiation']);

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"}Malformed/nonpositive selector. An empty list reports missing or invalid parameter: id/ids.
{"error":"opportunity status does not exist"}At least one selected row is absent; no edit commits.
{"error":"missing or invalid parameter: val"}New name missing, non-string or blank.
{"error":"parameter too long: val. max length 100 characters"}Trimmed name exceeds 100 Unicode characters.
{"error":"configuration write failed"}Primary insert/update or transactional history fails; the tenant transaction rolls back.
{"error":"configuration read failed"}Target/tenant-owner lookup fails.
{"error":"configuration transaction failed"}Transaction start/commit fails.
{"error":"configuration operation failed"}Unexpected database/runtime failure; transaction is rolled back.

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 complete batch and checked field history commit together, or roll back together. Missing rows no longer masquerade as success.
  • Only name changes; primary IDs and creation timestamps cannot be edited. Changed rows receive current Unix last_edited; unchanged rows do not advance it.
  • Names are trimmed consistently across legacy and mapped writes. Empty and whitespace-only names are rejected, including by updateField.
  • No built-in rename protection, duplicate-name check, feature flag or additional page permission is applied.
  • Returns {ok:1}, including a valid unchanged edit; this is not an affected-row count.

Side effects

  • Changed labels request the opportunity_statuses cache marker and record checked per-field history within the tenant transaction.
  • No email, notification, webhook or related opportunity rewrite occurs.

See it in Fieldmotion

CRM1

Open CRM1 Settings → General → Opportunity Statuses. pageSettingsOpportunityStatuses.js loads the legacy table, creates labels and saves inline name edits. CRM1 opportunity/customer screens and exports obtain the choices through OpportunityStatuses_list. Click a label and leave the inline input to send id and val.

CRM2

CRM2’s Opportunity Statuses settings screen (pageOpportunitySettingsStatuses.js) uses CommonList/CommonLists with type=opportunityStatus instead, not this table. No direct CRM2 settings caller to this endpoint was found. Reproduce this contract with the example request; do not assume that changing it changes CRM2’s CommonList choices.

Related endpoints