Forms
Archive or delete forms
/a/Forms_delete
Archive or permanently delete one or more form definitions according to form type, usage, and the force flag.
When to use this endpoint
Use the CRM2 archive-first workflow for ordinary administration: archive active forms, then call again with force=1 only after explicit confirmation.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session and is scoped to the authenticated tenant.
The handler performs no record-owner or page-permission check. Definition writes are blocked when the tenant’s features2.disableFormEdits flag is 1, except for the temporary setup user identified by userdata.meta.is_tmp=1.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | Integer-compatible or native array | Yes | One form ID or a native array. A scalar is wrapped; array entries are integer-coerced. JSON text is not decoded. |
force | Boolean-compatible integer | No | Default 0. A non-zero value bypasses usage/archive protection and permanently deletes supported form types. |
Example request
$result = FM_api('Forms_delete', [
'ids' => ['1042', '1043'],
'force' => '1',
]);
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 parameter: ids"} | The selector is absent. |
{"error":"This form does not exist!"} | At least one requested ID does not exist; preflight validation prevents every mutation in that request. |
{"error":"form edits are disabled for this account"} | Definition edits are disabled. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Every distinct requested ID is validated before any mutation. A missing ID therefore leaves all requested forms unchanged.
- Job forms (
0), Quote forms (4), Purchase Order forms (5), and Invoice forms (7) are archived when matching records exist andforceis false; otherwise they are deleted. - Job Tables (
3) and Quote Tables (6) are always archived unless forced. Other types enter the default permanent-delete branch. - All valid IDs in a batch are processed. Archive warning text is combined when multiple rows require warnings; archiving used Job forms also returns their live Job IDs.
- Permanent deletion removes the form’s parent links from linked tables, but does not rewrite existing business records that referenced the form.
Side effects
- Archive branches set
archived=1; only some branches also updatelast_edited. - Permanent branches hard-delete the row, record a
formsdeletion entry, synchronize table-parent metadata, and remove stored Autodoc files under that form ID.
See it in Fieldmotion
CRM1
CRM1’s Forms page exposes the legacy delete behavior and can receive an archive warning for a used form.
CRM2
The Forms page first archives active selections; a second explicitly confirmed Delete sends force=1 for already archived forms.
Related endpoints
Forms_getDataTablesupplies archive state to the CRM2 workflow.Form_setArchivedchanges archive state without permanent deletion.