Quotes: settings, costing and lookups
Suggest the next quote number
/a/Quote_getNextNumber
Derive a quote reference suggestion from the account’s numbering method.
When to use this endpoint
Use to prefill a create-quote form. The result is a suggestion only: no quote row or reserved sequence is created.
Authentication and permissions
Authenticates a signed API key or CRM session as its tenant user. Requires Quotes View (pageQuotes_view). Non-admin users blocked by legacy crm_access bit 32 are denied. Roleless non-admin users fail closed. Client administrators inherit page permissions.
Uses local tenant IDs. No additional Quote owner/department predicate is applied; these endpoints do not return a visibility-filtered Job list.
Parameters
This endpoint has no operation-specific parameters.
Example request
$number = FM_api('Quote_getNextNumber');
Example response
"QT-001043"
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
- Uses setting quote-number-method. Method 1 selects the latest non-deleted, nonempty quote number by cdate DESC then id DESC. Other/default values select the non-deleted, nonempty number by length DESC then lexical quote_num DESC; this is not a numeric MAX.
- Method 2 (Disable automated quote number) returns an empty string immediately, without a base-number lookup. Other methods with no base number return string 1.
- The increment collects every digit in the base number, adds one, and pads to the original total digit count. All nondigits are concatenated into a prefix. It does not increment just the trailing numeric segment: AB12CD34 becomes ABCD1235.
- No uniqueness check, lock, reservation, count limit or status filter beyond deleted=0/nonempty number. Concurrent callers can receive the same suggestion; mixed-prefix lexical ordering and very large numeric strings are not robust sequence management. There is no recurrence-origin filter on the base quote lookup.
- No direct mobile app/m-service caller for this RPC was found. This is a CRM quotation workflow.
Side effects
- Reads account setting and, depending on method, one base quote number. No write, cache update, audit or reservation.
See it in Fieldmotion
CRM1
No direct browser Quote_getNextNumber caller found. Legacy quote creation uses internal numbering logic; Quote settings exposes the shared method.
CRM2
Quotes → Create invokes Quote_getNextNumber before displaying the create layout; inspect the returned string used as the quoteNum default.
Related endpoints
Quote_setNumwrites an existing quote reference without uniqueness checks.