Jobs: recurrence workflows and lists
Remove eligible future child jobs while retaining the sequence and its example job
/a/JobRecurrence_deleteFromDate
Remove eligible future child jobs while retaining the sequence and its example job.
When to use this endpoint
Remove eligible future child jobs while retaining the sequence and its example job. Use the recurrence ID, not the example job ID, unless a parameter explicitly says otherwise.
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 |
|---|---|---|---|
id | Canonical positive integer string | Yes | Existing recurrence ID; strict integer validation, not a permissive intval-only identifier. |
date | YYYY-MM-DD string | No | Inclusive last day to retain, interpreted in the tenant timezone. When supplied and nonblank, cleanup starts at the following local midnight, never earlier than now. Zero-date sentinels are rejected as a supplied cutoff. |
from_now | Truthy flag | No | When nonempty, ignore date and remove children strictly after the current epoch. Omitted/blank date also selects this mode. |
Example request
$result = FM_api('JobRecurrence_deleteFromDate', ['id'=>'1042', 'date'=>'2026-11-30']);
Example response
{"ok":1}
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"} | ID missing or not a strict positive integer. |
{"error":"missing or invalid parameter: val"} | Malformed calendar date; shared date validation retains the val error label. |
{"error":"missing or invalid parameter: date"} | Supplied zero-date sentinel has no usable cutoff. |
{"error":"job recurrence does not exist"} | No recurrence row. |
{"error":"Invalid saved recurrence metadata"} | Stored metadata is not an array/object. |
{"error":"Recurrence is being rebuilt; retry after generation finishes"} | Generator building flag is truthy. |
{"error":"No permission to edit"} | Job edit restriction applies. |
{"error":"database error while getting jobs for recurrence"} | Child selection 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
- Uses normalized positive cached job IDs in first-seen order. The first valid ID is retained as the anchor even if it is later than the cutoff. Invalid tokens and duplicate IDs are ignored.
- Only non-deleted, incomplete cached children beyond the cutoff are selected. It does not discover jobs outside the saved cache. Completed and overdue jobs are retained.
- Date mode uses meeting_time_e >= max(now, local midnight after date); from-now mode uses meeting_time_e > now. A historical cutoff never deletes past jobs.
- Rejects malformed stored metadata and a truthy meta.building generation flag. It does not clear the building flag or stop a running generator.
- Delegates to Jobs_delete and propagates errors/warnings, including partial progress. If cleanup succeeds or no children qualify, runs updateNext and returns its result.
- Mobile clients were checked separately: recurrence notes/files are synchronized through m/www syncDownloads/syncDownloadOne and notes uploads, not direct calls to this endpoint. Those intermediary contracts are not expanded by this API route.
Side effects
- Eligible jobs go through canonical audited soft deletion, with normal per-job lifecycle effects and recurrence-cache maintenance. Configuration remains.
- Refreshes derived next/last maintenance dates through updateNext. Multiple job deletes and the final refresh are not one all-or-nothing request. No direct scheduler bump or reminder change.
See it in Fieldmotion
CRM1
Saving recurrence settings or deleting a sequence reaches this through the server-side helpers. Observe Job_save, JobRecurrence_set or JobRecurrence_delete rather than expecting a separate cleanup request.
CRM2
The frequency editor calls JobRecurrence_set; job editor saves call Job_save. Both can invoke this internally. No separate direct UI call was found.
Related endpoints
JobRecurrence_setsaves checked settings and requests the appropriate cleanup.JobRecurrence_updateNextrefreshes derived dates without deletion.