Accounts and tax types
Rename a nominal account
/a/Account_setName
Rename one account and keep its display name in step with the new name.
When to use this endpoint
Use Account_setName for CRM1’s inline account-name edit. The CRM2 Finance page uses the bulk snapshot route.
Authentication and permissions
The request must establish an authenticated tenant context with signed API credentials or a logged-in CRM session. This legacy handler checks for the tenant database prefix rather than calling the normal login guard.
It performs no additional Finance-page, client-admin, role, create, edit, or delete permission check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive account ID. |
val | String | Yes | Trimmed nonempty name, maximum 50 bytes according to this legacy setter. Other account writers accept up to the schema’s 128 characters. |
Example request
$result = FM_api('Account_setName', [
'id' => 331042,
'val' => 'Domestic sales',
]);
Example response
{"ok":1}
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"} | The ID is absent or not positive. |
{"error":"missing or invalid parameter: val"} | The value is absent or blank after trimming. |
{"error":"name too long. max length 50"} | The trimmed value exceeds 50 bytes. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Both
nameanddisplay_nameare overwritten with the same value. - An unknown positive ID is a silent no-op that still returns success.
Side effects
- Advances the account’s
last_editedtimestamp and clears the account cache.
See it in Fieldmotion
CRM1
Open Settings → Finance. CRM1 loads and edits the Chart of Accounts, Tax Types, and Tax Groups from this endpoint family; filter browser developer tools for the exact function name. Edit an existing Account Name cell to send Account_setName.
CRM2
CRM2 does not call this setter; its Save action sends Account_updateData.
Related endpoints
Account_setNominalchanges the account code.Account_updateDataaccepts names up to 128 characters.