When to use this endpoint

Use Customer_setAccountManager when a workflow already knows both the customer ID and the user ID to store as its account manager.

Validate the user in the calling workflow: this focused setter accepts an arbitrary integer and does not confirm that the user exists or is active.

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 to update. It must convert to an integer of at least 1.
valInteger stringNoUser ID to store. Omitted, blank, and non-numeric values convert to 0, clearing the assignment. Negative integers are stored as supplied.

Example request

$result = FM_api('Customer_setAccountManager', [
	'id' => '1088',
	'val' => '42',
]);

Example response

{
  "ok": 1
}

When the converted integer already matches, the response is {"ok":1,"msg":"no change needed"}.

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 not a positive integer.
{"error":"customer does not exist"}No customer row with that ID exists in the tenant.

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 customer lookup has no active/deleted filter, so it can update inactive and soft-deleted rows.
  • Input uses PHP integer conversion; for example, "user-42" becomes 0.
  • A no-change request returns before the timestamp, cache, or audit log is changed.
  • This is a single-record mutation; it provides no list filtering or pagination.

Side effects

  • A real change updates account_manager, last_edited, and edited_uuid, then invalidates the customer cache.
  • It writes a customer audit-log entry. Unlike many customer field setters, it does not fire Customer_edit.

See it in Fieldmotion

CRM1

Open a customer in the legacy edit popup, change Account Manager, and filter Network requests for Customer_setAccountManager. CRM1 supplies the selected user ID.

CRM2

No direct production CRM2 caller was found. CRM2 uses its layout-driven customer update contract.

Related endpoints