When to use this endpoint

Use for the CRM2 On Complete “copy to forms” action. A successful response does not enumerate which selected forms matched.

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

ParameterTypeRequiredDescription
idNative nonempty arrayYesTarget Form IDs as a nonempty native list of positive decimal integer IDs. Scalars, JSON text, nested arrays and malformed/overflow values are rejected before SQL. Duplicate IDs are removed.
ruleJSON textYesOne serialized rule object; the same rule is inserted in each matching form.

Example request

$result = FM_api('Form_addMultipleOncompleteRule', [
	'id'=>['1042','1043'],
	'rule'=>json_encode(['type'=>'setField','fieldID'=>'Result','value'=>'Checked']),
]);

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

ResponseCondition
{"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"}id absent, empty, not a native list or containing an invalid ID.
{"error":"missing parameter: rule"}rule absent.
{"error":"missing or invalid parameter: rule"}Invalid JSON rule.
{"error":"form does not exist or is not a Job form"}No selected type-0 form 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

  • Selects only type-0 forms; archived forms remain eligible. Missing/non-Job IDs are silently omitted unless none match. Rules are validated recursively for configured setJobStatus indexes, but other rule properties are not comprehensively validated.
  • Initializes a default first group whenever the saved first constraints list is absent/empty. Unlike the single-target route, initialization is not limited to the exact stored text []. Other groups are preserved.
  • Inserts before the first doNothing, or appends when no sentinel exists. Repeated requests duplicate the rule. No endpoint pagination or explicit batch-size limit is imposed.

Side effects

  • Locks matching forms and saves on_complete, last_edited, cache invalidation and per-form Undo baselines/snapshots in one checked transaction. A failure rolls back the batch. It does not execute the new automation.

See it in Fieldmotion

CRM1

No direct CRM1 caller found; its On Complete copy action uses Form_addOncompleteRule.

CRM2

Open a Job Form’s On Complete rules, copy a group/rule to selected Forms, and filter Network for Form_addMultipleOncompleteRule. The dialog sends a native ID array plus serialized rule, and handles the open form separately.

Related endpoints