Customers
Set a customer county
/a/Customer_setCounty
Change or clear one customer county while attempting to update address history and dependent caches.
When to use this endpoint
Use Customer_setCounty for a focused county or regional address correction on a known customer.
Read the assembled address first if an integration must preserve a consistent historical snapshot.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Customer to update; it must convert to a positive integer. |
val | String | Yes | New county, trimmed before comparison and storage. A present blank value clears it. The setter itself has no length limit. |
Example request
$result = FM_api('Customer_setCounty', [
'id' => '1088',
'val' => 'County Antrim',
]);
Example response
{
"ok": 1
}
An unchanged trimmed county returns {"ok":1,"msg":"no change needed"}.
Errors and unusual responses
| Response | Condition |
|---|---|
{"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; present blank is valid. |
{"error":"customer does not exist"} | No matching customer row exists. |
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 lookup has no active/deleted filter.
Address_setvalidates the assembled address before the final update; any error from it is discarded.- Address history/cache work and the customer update are not wrapped in a transaction.
- This is a single-record mutation; it provides no list filtering or pagination.
Side effects
Address_setcan insert or merge history, clear cached customer details on linked non-deleted jobs and invoices, and mark this customer and descendants as edited.- The final write updates
county,last_edited, andedited_uuid, invalidates the customer cache, logs the edit, and firesCustomer_edit.
See it in Fieldmotion
CRM1
Open the legacy customer edit popup, change County, and filter Network requests for Customer_setCounty.
CRM2
No direct production CRM2 caller was found. CRM2 saves customer addresses through its layout-driven update flow.
Related endpoints
Customer_getAddressreturns assembled current or historical address values.Customer_getretrieves the current customer row.