Opportunity statuses and referrals
Permanently remove opportunity-status rows selected by mapped filters
/a/OpportunityStatus_delete
Permanently remove opportunity-status rows selected by mapped filters.
When to use this endpoint
Permanently remove opportunity-status rows selected by mapped filters. Use the exact wire names below; these APIs are not interchangeable with the similarly titled CRM2 CommonList settings.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. The handler requires login but does not check a settings-page permission, role or record owner. All rows in this family belong to the authenticated tenant’s opportunity_statuses table.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id / name / cdate / lastEdited | Scalar or native array | At least one | All supplied mapped filters are ANDed. Scalar text uses quoted equality without trimming; numeric values are coerced. Arrays use IN membership. Prefer one explicit id or a nonempty id array; ids is not an alias here. |
Example request
$result = FM_api('OpportunityStatus_delete', ['id' => '1042']);
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 filter"} | No mapped selector supplied. |
{"error":"Could not read records for deletion. Please retry."} | Pre-delete read fails. |
{"error":"Could not delete records. Please retry."} | Delete query fails. |
{"error":"Could not record deletion audit."} | Audit fails after rows have already been deleted. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- No match is a successful no-op. Filters can match multiple rows; an empty numeric list matches none.
- This table is outside the generic soft-delete allowlist and lacks deleted/ddate columns in the representative schema. The handler physically deletes rows rather than setting a deletion flag.
- No built-in-ID protection or linked opportunity/reference check is performed. Existing records are not remapped to another status.
Side effects
- Requests the opportunity_statuses cache marker, records selected IDs/snapshots through the deletion-audit helper and adds generic deletion history. These steps are not one atomic transaction.
- No email, webhook or opportunity reassignment is performed.
See it in Fieldmotion
CRM1
Open CRM1 Settings → General → Opportunity Statuses. pageSettingsOpportunityStatuses.js loads the legacy table, creates labels and saves inline name edits. CRM1 opportunity/customer screens and exports obtain the choices through OpportunityStatuses_list. The reviewed screen does not offer a direct delete caller; reproduce with an isolated label rather than a built-in choice.
CRM2
CRM2’s Opportunity Statuses settings screen (pageOpportunitySettingsStatuses.js) uses CommonList/CommonLists with type=opportunityStatus instead, not this table. No direct CRM2 settings caller to this endpoint was found. Reproduce this contract with the example request; do not assume that changing it changes CRM2’s CommonList choices.
Related endpoints
OpportunityStatuses_listsupplies picker labels.OpportunityStatus_getRequestedDetailsreads mapped fields.