When to use this endpoint

Use Customer_setIndustry for the focused Industry field used by the legacy customer editor.

The endpoint accepts free text rather than a validated industry record or enumeration.

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 stringYesCustomer ID; it must convert to a positive integer.
valStringYesComplete industry text. It is stored verbatim; blank clears the field, and whitespace is not trimmed.

Example request

$result = FM_api('Customer_setIndustry', [
	'id' => '1088',
	'val' => 'Facilities management',
]);

Example response

{
  "ok": 1
}

The same response is returned for a nonexistent ID and for an unchanged value.

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 invalid.
{"error":"missing or invalid parameter: val"}val was omitted.

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 performs no active/deleted lookup, trimming, length validation, or no-change detection.
  • The value is opaque text; no related industry object is resolved.
  • Retrying the same request still updates the timestamp and emits side effects.
  • This is a single-record mutation; it provides no list filtering or pagination.

Side effects

  • The update attempts to set industry, last_edited, and edited_uuid. It does not explicitly invalidate the customer cache.
  • It writes a customer audit-log entry and fires Customer_edit, including when no row matches.

See it in Fieldmotion

CRM1

Open the legacy customer edit popup, change Industry, and filter Network requests for Customer_setIndustry.

CRM2

No direct production CRM2 caller was found. CRM2 customer forms use a layout-driven update.

Related endpoints

  • Customer_get confirms the stored value and whether the customer exists.
  • Customers_list finds candidate customers before an update.