Forms
Compare two form field definitions
/a/Form_areFieldsEqual
Compare complete ordered field definitions before a table-merge workflow.
When to use this endpoint
Use as CRM1’s compatibility check before merging duplicate tables. All stored field properties matter; form-level names, settings and existing job answers remain outside this field comparison.
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 form, department, owner, or page-permission check unless the page below says otherwise. CRM navigation may impose additional UI-only access rules.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
form_a / form_b | Integer-compatible form IDs | Both | Both IDs must integer-convert above zero. Both forms must exist, including when the supplied IDs are identical. |
Example request
$comparison = FM_api('Form_areFieldsEqual', ['form_a'=>'1042','form_b'=>'1088']);
Example response
{"ok":1,"is_equal":1}
On a difference, the reply is an error with decoded full fields arrays under form_a and form_b, not {is_equal:0}. Missing records have a separate error.
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 parameters: form_a, form_b"} | Either ID converts below 1. |
{"error":"one of the forms does not exist"} | At least one form row is absent. Database failures return Unable to compare form fields. |
{"error":"fields are not equal","form_a":[...],"form_b":[...]} | Complete canonical field definitions differ. The actual response contains decoded stored arrays; ellipses here denote their contents. |
{"error":"Form fields are invalid; comparison was not performed."} | A fields value is not a valid ordered list of named, typed field objects. |
{"error":"Field metadata is invalid; comparison was not performed."} | A field meta value is malformed or not a JSON object/array. |
{"error":"Unable to compare form fields"} | Database lookup or another comparison operation failed. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Authenticated lookup verifies both forms, including for equal IDs. Archived definitions and every form type are eligible; equality is about fields, not form-level type/name/settings.
- Compares all stored field properties, including extras, validation/options and stable IDs inside meta. Different table references or options therefore prevent equality. Field order and ordered option arrays remain significant.
- Object property order is canonicalized recursively. Valid JSON in each field’s meta is decoded before canonical comparison, so whitespace/key order inside equivalent metadata objects does not create a false difference. Object/array and scalar types remain significant; a missing meta defaults to an empty array.
- Malformed fields or metadata return explicit errors rather than equality. A difference still returns error plus the decoded original fields arrays under form_a/form_b; it does not mutate or normalize stored definitions.
- No direct mobile app/m-service caller was found. This check is read-only and does not move job answers, replace parent references or archive a table.
Side effects
- Read-only; no history, cache invalidation, file write, URL fetch or report rendering.
See it in Fieldmotion
CRM1
Forms duplicate-table merge (widgetMergeTables) compares each selected table against the first with Form_areFieldsEqual, then performs separate reads, retargeting and archive calls.
CRM2
No direct production caller found. Current Forms editing does not use this legacy table-merge check.
Related endpoints
Form_listFormsWithTablefinds parent forms for the merge workflow.Form_getreturns the enclosing form settings, which this comparison does not compare.