Jobs: recurrence workflows and lists
Attempt a tenant-wide reset of already generated jobs for every active recurrence
/a/JobRecurrence_resetMonth
Attempt a tenant-wide reset of already generated jobs for every active recurrence.
When to use this endpoint
Attempt a tenant-wide reset of already generated jobs for every active recurrence.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session and tenant context. Job edit-restriction bit 128 applies, with the existing client-administrator exception. There is no additional recurrence-owner or department-visibility filter.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
areyousure | Scalar flag | Yes | Must loosely equal 1. There is no recurrence ID or date scope; id, rid and date do not narrow the operation. |
Example request
$result = FM_api('JobRecurrence_resetMonth', ['areyousure'=>'1']);
Example response
[]
This example is the no-active-recurrences success case. Populated successes return a clean JSON array of original rows. Error/warning responses can identify partial recurrence progress.
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":"you must add \"areyousure\" parameter set to 1"} | Confirmation absent/not loosely 1. |
{"error":"No permission to edit"} | Job edit restriction applies. |
{"error":"Unable to read recurrences"} | Initial recurrence query failed. |
{"error":"Recurrence is being rebuilt; retry after generation finishes"} | A sequence is currently being built; previously processed sequences remain changed. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Despite its name, this is not a calendar-month operation. Iterates all active recurrences in ID order and removes eligible incomplete children strictly more than 86400 seconds after now.
- Uses the checked cleanup helper: the first valid normalized cached ID is the retained anchor, including caches with leading blanks. Completed, deleted, past and within-24-hour jobs are not selected.
- Honors the generator-building lock and malformed-metadata checks. Cleanup errors/warnings stop the reset; failures report updatedRecurrenceIds and failedRecurrenceId, while retaining nested job-level partial details.
- After successful cleanup, bumps worker priority. A bump failure returns ok=1, saved=1 and a warning identifying the failed recurrence; it does not silently claim full completion.
- Successful response remains the original pre-reset full recurrence-row array, not refreshed records or a deletion count. No active recurrences returns []. The endpoint emits no progress text before JSON.
Side effects
- Eligible jobs go through canonical audited soft deletion and lifecycle follow-ups. No outer transaction spans the tenant-wide reset; an earlier sequence may already be changed when a later one fails.
- Backdates worker priority after cleanup; does not synchronously generate jobs. Edit permissions are checked before processing.
See it in Fieldmotion
CRM1
No direct production CRM1 caller found for this route.
CRM2
No direct production CRM2 caller found for this route.
Related endpoints
JobRecurrence_deleteFromDateprovides a checked, single-sequence cutoff cleanup.