Forms
Count jobs affected by a form edit
/a/Form_countJobs
Count active jobs using a Job form or a Job Table’s recorded parent forms.
When to use this endpoint
Use before a potentially destructive field rename/type change. CRM1 and CRM2 use this result when deciding whether a save needs a warning or typed 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 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 |
|---|---|---|---|
id | Integer-compatible form ID | Yes | Positive integer-converted local form ID. |
Example request
$usage = FM_api('Form_countJobs', ['id'=>'1042']);
Example response
{"jobs":"12"}
For type 0, jobs is the database COUNT scalar, commonly a string. For type 3, it is an integer accumulated from parent counts (including integer zero for an unlinked table).
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":"invalid parameter: id"} | Missing/null/nonpositive integer-converted ID. |
{"error":"form does not exist"} | No form row or failed initial lookup. |
{"error":"unknown form type: 4"} | Only types 0 and 3 are implemented; the actual unsupported type is included in the message. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Type 0 counts meetings with that form_id and deleted=0. Includes all job statuses, without a date, assignee, department or record-scope restriction; archived form definitions remain eligible.
- Type 3 decodes meta.form_parents and sums active-job counts for each listed parent ID. It does not scan parent definitions or job table answers. Absent parent metadata means zero; stale/duplicate parent IDs can under/over-count.
- The count is a current read, not a lock or snapshot guaranteeing a later save affects exactly that many jobs. A failed count is not consistently distinguished from zero by the helper/accumulation paths.
- No direct mobile app/m-service caller for this RPC was found. Mobile form definitions arrive through m’s syncDownloads form channel, not this endpoint.
Side effects
- Read-only; no history, cache invalidation, file write, URL fetch or report rendering.
See it in Fieldmotion
CRM1
Form Edit calls Form_countJobs before risky changes to a main form or Job Table. The save flow escalates confirmation based on count; it is not a server-side edit prohibition.
CRM2
Form Edit calls it at save time for risky field changes. Positive counts show warnings; more than 10 linked jobs require typed confirmation in the UI.
Related endpoints
Form_listFormsWithTablescans actual direct parent references instead of cached parent metadata.Form_getreturns the definition being edited.