Jobs: recurrence workflows and lists
Remove one job from the recurrence’s cached membership without deleting the jobs
/a/JobRecurrence_removeJob
Remove one job from the recurrence’s cached membership without deleting the jobs.
When to use this endpoint
Remove one job from the recurrence’s cached membership without deleting the jobs.
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 |
|---|---|---|---|
rid | Integer-like scalar | Yes | Positive recurrence ID, intval. |
aid | Integer-like scalar | Yes | Positive job ID, not a recurrence ID. |
Example request
$result = FM_api('JobRecurrence_removeJob', ['rid'=>'1042', 'aid'=>'501']);
Example response
{"ok":1}
Empty membership: {"ok":1,"warning":"last job in recurrence removed; recurrence retained inactive"}. Follow-up failure: {"ok":1,"saved":1,"warning":"Recurrence membership saved; schedule refresh needs review."}. Inspect persisted state before replaying.
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: rid"} | Missing/nonpositive sequence ID. |
{"error":"missing or invalid parameter: aid"} | Job selector absent/invalid. |
{"error":"This recurring sequence does not exist"} | Recurrence row absent. |
{"error":"Unable to save job delivery changes"} | Tenant transaction failed. |
{"error":"No permission to edit"} | Job edit restriction applies. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Locks the recurrence and removes IDs from its positive de-duplicated cache. If the cache is empty, first falls back to non-deleted jobs whose recurrence_id matches the sequence.
- If no cached members remain, retains the recurrence inactive, clears its next date and linked maintenance next job/date, and disables global registration. This returns a warning, not an error.
- Job selector is the legacy wire name aid; it refers to a job.
- If members remain, calls updateNext after commit. A failed post-commit scheduler/date refresh returns ok=1, saved=1 and a warning rather than rolling membership back.
- Missing requested job IDs subtract nothing. Existing active jobs linked by their recurrence column or metadata have matching backlinks cleared in the same transaction; the jobs are retained, not deleted.
- A later membership fallback cannot rediscover those detached jobs. The internal per-job deletion helper retains a separate contract and does not use this public backlink-detachment branch.
Side effects
- Checked tenant transaction updates membership/edit markers, clears matching job backlinks with fresh job edit markers and per-job history, and records recurrence history. Empty sequences clear linked maintenance next-state.
- Global disable or derived-date refresh happens after commit. Type-7 reminders are not explicitly removed. No job is soft-deleted by membership removal.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found. The recurring-jobs screen uses focused controls and its legacy table.
CRM2
No direct production CRM2 caller was found. The recurring-jobs module uses mapped records and checked frequency controls.
Related endpoints
JobRecurrence_updateNextrecomputes dates from cached membership.JobRecurrence_deleteFromDateactually soft-deletes eligible child jobs.