Quotes: settings, costing and lookups
Save quote tags
/a/Quote_setTags
Store tag text in the quote’s metadata.
When to use this endpoint
Use for the legacy Quotes tag editor. One tag per line is a client convention; explicit blank text clears tags.
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 | Positive integer-compatible quote ID | Yes | Positive local quote ID, integer-converted; an active quote is required. |
val | String | Yes | Explicit string; blank clears and literal 0 is valid. Stored as HTML-escaped text; newlines are preserved. |
Example request
$result = FM_api('Quote_setTags', ['id'=>'1042','val'=>"Safety\nAnnual 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":"missing or invalid parameter: id"} | Missing/nonpositive quote ID. |
{"error":"missing or invalid parameter: val"} | val is omitted/null. Invalid content or a missing related record produces a specific validation error without a write. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Requires an explicit string val. Blank clears tags; literal 0 is valid. HTML-escapes text, stores meta.tags using JSON encoding and bound SQL, and preserves other metadata keys.
- No tag splitting, deduplication or date interpretation. Identical stored text returns warning=no change needed. Null/empty outer metadata initializes; malformed metadata returns an error without replacing it.
- 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 → Tags editor calls Quote_setTags with id/val. Filter the Network panel for that exact function.
CRM2
CRM2 Quotes uses moduleQuotes and the shared mapped editor. No direct call to this dedicated setter was found; ordinary edits use Quote_updateData/Quote_updateField.
Related endpoints
Quote_getTagsreads the stored escaped text.