Form definitions, recorded responses and exports
Remove or archive a legacy form
/a/Form_delete
Apply the legacy per-type removal rules to one form definition.
When to use this endpoint
Use only after checking form type and usage. Archive a definition when it must remain available to historical records. This legacy route may permanently remove records and assets.
Authentication and permissions
Authenticate with a signed API key (acting as its owner) or a logged-in CRM session on the routed account host. Session calls include the dispatcher’s CSRF value when configured. IDs refer to the authenticated tenant unless an explicit cross-account copy is described.
The handler adds no Forms page/role check. The dispatcher does not add a Form record-scope predicate; a screen’s CRM2 role controls are not evidence of an API restriction or a CRM1 permission requirement.
The account’s features2.disableFormEdits setting blocks this mutation with form edits are disabled for this account. A temporary user marked meta.is_tmp=1 bypasses that setting only.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer-compatible ID | Yes | Form definition ID. |
force | Integer-compatible legacy flag | No | Default 0. Nonzero bypasses the Job/Quote/Purchase Order/Invoice/Opportunity usage checks and table archive branch. This is an unsafe legacy control, not a normal integration deletion workflow. |
Example request
$result = FM_api('Form_delete', ['id'=>'1042']);
Example response
{"ok":1}
Database numeric values can be JSON strings. Examples are representative; legacy application errors can use HTTP 200, so inspect the decoded response.
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: id"} | Missing/nonpositive ID. |
{"error":"This form does not exist!"} | No form row exists. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- For type 0 Job Forms, active nondeleted Jobs cause archival with a warning and ids containing affected Job IDs. With no active usage, or force, the form is physically removed. Deleted Job history is not counted by that usage check.
- Types 4 Quote, 5 Purchase Order, 7 Invoice and 9 Opportunity count referencing records without excluding deleted records: usage archives instead of removing unless force is supplied. Opportunity removal (including force) resets matching Opportunity form_id references and timestamps.
- Types 2, 3 and 6 archive unless force is supplied, even without recorded usage. That table archive branch does not update last_edited. Other types take the default physical-removal path, including newer table type codes not explicitly handled.
- Archived Job/finance forms receive last_edited and forms-cache invalidation. A successful archive response is not proof of deletion: inspect warning and read back archived. No pagination applies.
Side effects
- Physical removal unlinks the parent from linked-table metadata, removes the form row, records the forms deletion log and deletes registered AutoDoc files. It creates no deletion Undo snapshot. Steps and usage checks are not one checked transaction; force can leave historical references.
See it in Fieldmotion
CRM1
In Forms, Delete calls Form_delete; an in-use Job Form can return a warning and Job IDs, and legacy confirmation paths can retry with force.
CRM2
The current Forms bulk Delete flow first archives active selections through Form_updateData, then uses the separate bulk Forms removal workflow. Its UI lifecycle checks must not be assumed to exist in this singular handler.
Related endpoints
Form_getRequestedDetails— check type, archived and current definition.Form_updateData— archive a form explicitly.