Customers
Retrieve the highest sorted account number
/a/Customer_getHighestAccountNumber
Return the nonblank account number that sorts first by string length and then descending text value.
When to use this endpoint
Use Customer_getHighestAccountNumber to show the legacy “highest account number” hint used by customer-creation dialogs.
Do not treat it as a numeric maximum unless the tenant stores a uniform numeric format. Customer_getNextAccountNumber applies the related legacy increment algorithm.
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
This endpoint has no operation-specific parameters.
Example request
$highest = FM_api('Customer_getHighestAccountNumber');
Example response
"C009"
When there are no qualifying values, the JSON response is the empty string "", not an object.
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. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Only
deleted=0rows with a nonblank account number participate; inactive customers remain eligible. - Ordering is by
length(account_number) DESC, thenaccount_number DESC. It is a string-ordering rule, not numeric parsing. - The endpoint returns one scalar and has no caller-controlled filtering or pagination.
See it in Fieldmotion
CRM1
Open the legacy Create Customer dialog. CRM1 calls Customer_getHighestAccountNumber to show the small highest-number hint beside Account Number.
CRM2
CRM2 calls it in customer and subsidiary creation flows before requesting the next suggested number. Filter Network requests for Customer_getHighestAccountNumber.
Related endpoints
Customer_getNextAccountNumberderives a suggested successor.Customer_checkAccountNumberIsUniqueperforms the non-atomic collision preflight.