Jobs: field and bulk edits
Change due dates for selected jobs
/a/Jobs_setDueDate
Move selected active jobs’ due dates while preserving valid existing times and rescheduling overdue reminders.
When to use this endpoint
Move selected active jobs’ due dates while preserving valid existing times and rescheduling overdue reminders.
Read the target jobs first with Jobs_getSome to obtain the current values and confirm the IDs belong to the intended account.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. Requests address physical job IDs in the authenticated account.
The legacy job-edit restriction bit 128 blocks the request with No permission to edit, including client administrators, matching the restricted focused setters. No additional assignee or department scope is applied.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | Native array | Yes | Required native list, not encoded JSON. Members are cast to integer, nonpositive IDs discarded and duplicates removed; missing/deleted IDs are omitted by the active-job query. |
date | YYYY-MM-DD string | Yes | Strict full date, with a real calendar day and year at least 1000. No time suffix, blank, rollover date or trimming is accepted. |
Example request
$result = FM_api('Jobs_setDueDate', ['ids'=>['1042','1088'], 'date'=>'2026-11-20']);
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: ids"} | ids is absent or null. |
{"error":"parameter ids should be an array"} | ids is not native PHP-array input. |
{"error":"missing or invalid parameter: date"} | date is absent, non-string or not a strict valid date. |
{"error":"Could not read jobs. Please retry."} | The active-job list query fails. |
{"error":"Could not read job 1042. Please retry.","failedId":1042,"updatedIds":[]} | A selected job’s second read fails or no longer finds it; the message contains the actual job ID. |
{"error":"Could not update due date for job 1042. Please retry.","failedId":1042,"updatedIds":[]} | A primary write fails; later jobs and that job’s follow-up effects are skipped. The message contains the failing ID. |
{"error":"No permission to edit"} | The legacy job-edit restriction applies to this authenticated user. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Success uses the string '1', not the numeric 1 used by single-job setters. A list reduced to empty, or no matching active jobs, is also success.
- Jobs whose stored date portion already equals date are skipped without writes, history or notification changes.
- If the old due date has a syntactically valid HH:MM:SS suffix, that time is retained. Otherwise the stored replacement is date-only. due_date_e is not updated.
- Queries/processes all selected active jobs with no pagination or guaranteed ordering. The operation stops on checked read/write failure, but earlier changes remain committed; errors identify failedId and updatedIds for the successfully written prefix.
- The customer touch and notification writes are not checked. No outsourced counterpart is updated by this bulk path.
Side effects
- For changed jobs, advances last_edited/edited_uuid and invalidates the meetings cache.
- Sets on_app=0, touches the linked customer’s last_edited only for customer-type jobs, not asset-type jobs, and records job history for each changed job.
- Reschedules overdue email and existing overdue SMS entries for date at 23:59:59 using PHP’s current timezone, independent of the preserved stored due-time suffix. Cron_update creates a missing future email row, not a missing SMS row or new past-due email reminder. No immediate email is sent.
See it in Fieldmotion
CRM1
In CRM1 Jobs list select several rows, open the bulk-edit menu and choose Change Job due date. jobsMultiEdit.js calls Jobs_setDueDate; filter Network for that route.
CRM2
In CRM2 Jobs list select several rows, open the bulk-edit menu and choose Change Job due date. lib/jobsMultiEdit.js calls Jobs_setDueDate; filter Network for that route.
Related endpoints
Job_setDueDatechanges one job and also mirrors its due date to an outsourced counterpart.Jobs_getSomereads selected job records before editing and verifies the stored result afterward.