Jobs: scheduling and lifecycle
Restore a soft-deleted job row
/a/Job_restore
Make a deleted job active again from a trusted Admin-console login, without reconstructing its removed dependencies.
When to use this endpoint
Use the shared deleted-object restoration workflow after reviewing the consequences of the original deletion. Ordinary integration API keys are not sufficient.
Authentication and permissions
Requires an authenticated session with login_source exactly admin-console. Being a tenant admin or holding a signed API key alone does not satisfy this trusted-login guard.
No additional per-job ownership/role guard is applied after the Admin-console login check. Restoration is scoped to that session's tenant.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Positive ID of a row with deleted=1 in the current tenant. An active job is not a successful no-op. |
Example request
// Within the trusted Admin-console session (ordinary FM_api keys are rejected).
// POST /a/Job_restore with form field id=1042.
Example response
{"ok":1,"type":"job","id":1042,"label":"Job #1042 (JOB-1042)","summary":{"type":"job","id":1042,"job_ref":"JOB-1042"}}
label includes the job reference when nonblank. summary contains type/id plus nonblank descriptive metadata (job_ref for a job), not the full selected database row.
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"} | Missing/nonpositive ID. |
{"error":"admin console login required"} | Authenticated request did not originate from a trusted Admin-console login. |
{"error":"deleted job not found"} | No deleted row matches, including already-restored jobs. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Only clears deleted and ddate; it does not change lifecycle status or advance last_edited/edited_uuid.
- Marks only the latest active deletion-log entry restored with the actor/time/restore function. Other removal entries can remain; this is not a full mobile-resync repair.
- Does not rebuild removed quote/invoice/task/contract links, recurrence membership, retired cron schedules or undo remote cancellation. Movement history retained by current deletion paths remains available; older releases may already have removed it.
- The shared restore helper does not check update/audit return values or use a transaction. No pagination or bulk ID contract.
Side effects
- Clears the soft-delete fields, updates restoration metadata on the latest deletion entry and recounts direct-customer jobs. Does not fire Job_new, schedule creation notifications or re-run completion.
See it in Fieldmotion
CRM1
No ordinary CRM1 browser caller was found. This is the trusted Admin-console deleted-object recovery surface, not a Jobs-list undelete action.
CRM2
No ordinary CRM2 browser caller was found. CRM2 delete actions do not call a matching restore automatically.
Related endpoints
Job_deletedeletes one job through checked local cleanup.Jobs_deleteuses the same helper for a selected ID batch.Job_setStatusincludes the extra single-job transition follow-ups.