Quotes: settings, costing and lookups
Save a quote form answer
/a/Quote_setField
Replace one key in the quote’s stored form-answer object.
When to use this endpoint
Use with a key supplied by the quote’s form editor. A table’s encoded rows can be a parent-field value; the handler does not infer field types.
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. Also requires Quotes Edit (pageQuotes_edit); client administrators inherit page permissions.
Uses local tenant IDs. The active quote must also satisfy the account’s customer department/account-manager visibility filters for non-admin users, including signed-key requests.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible quote ID | Yes | Positive local quote ID, integer-converted; an active quote is required. |
key | Form-answer key | Yes | Non-null key, normally stable field ID. Not checked against the form definition. |
val | Answer value | Yes | Non-null new value; blank text allowed. JSON strings remain strings; no field-type or required-value validation. |
Example request
$result = FM_api('Quote_setField', ['id'=>'1042','key'=>'1042001','val'=>'Annual service']);
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":"quote does not exist"} | The active quote is missing (lookup failures are reported separately). |
{"error":"Unable to save quote. Check the saved state before retrying."} | Database, audit, transaction or commit acknowledgement failed. Refresh saved state before retrying an uncertain commit. |
{"error":"permission denied"} | Required Quotes permission is absent or the non-admin actor is blocked by legacy access settings. |
{"error":"id, key, val parameters all required"} | id, key or val is missing/null; a nonpositive ID separately fails validation. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Preserves existing decoded form_fields and changes only key. Empty legacy storage initializes an array; malformed JSON is rejected without overwriting it. Values may be scalar or arrays.
- An identical value returns warning=no change required. This legacy setter does not verify the key against the configured Form, validate its field type, or recalculate dependent fields.
- Locks the active quote in a tenant transaction. Bound writes, last_edited (server-local date/time), quote history and quotes cache invalidation are checked together. Audit or primary write failure rolls back. Existing caller transactions retain a savepoint; an uncertain commit returns an error and is never replayed automatically.
- No direct mobile app/m-service caller for this RPC was found.
Side effects
- Updates the named data and last_edited, records quote history and requests quotes cache invalidation in the tenant transaction. No ordinary mention notice, notification or email is sent by this dedicated handler.
See it in Fieldmotion
CRM1
Quotes → Notes/Fields sends Quote_setField for answer changes, including a table’s serialized row value.
CRM2
No direct Quote_setField caller found. widgetFormField answers are saved through mapped quote form fields.
Related endpoints
Quote_setFieldImageuploads bytes and returns an encoded image reference.Quote_getTableColumnSumreads one stored table-answer column.