Jobs: field and bulk edits
Mark a job report as sent
/a/Job_setPdfSent
Stamp the job’s report-sent indicator after a separate email workflow has accepted the report.
When to use this endpoint
Stamp the job’s report-sent indicator after a separate email workflow has accepted the report.
Read the target job 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. The request uses the authenticated account’s job IDs, not mobile app IDs.
No extra page, role, assignee, department or client-administrator check is applied by this handler.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Physical job ID in the authenticated account, converted with intval; must be positive. |
Example request
$result = FM_api('Job_setPdfSent', ['id'=>'1042']);
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 is absent or converts to a nonpositive integer. |
{"error":"Unable to save job"} | The primary database write failed. History and dependent effects are not performed for that failed save. |
{"error":"job does not exist"} | The active target is missing/deleted or the existence lookup 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
- Sets meta.pdf_sent to the current server Unix time in seconds. Repeated calls overwrite it; there is no caller-supplied timestamp.
- Requires an active job before writing. A missing/deleted target or failed existence lookup returns job does not exist. The final UPDATE also excludes deleted jobs.
- This only marks state: it does not create a PDF, enqueue/send an email or confirm recipient delivery.
- The primary UPDATE is checked before history and dependent effects. There is no transaction combining this field write with later cross-object effects; inspect committed-success warnings before retrying.
Side effects
- Writes last_edited and edited_uuid with the changed fields and invalidates the meetings cache.
- Records a job history entry. No mail is sent directly by this setter.
- Reads and rewrites the metadata object with pdf_sent. It does not mirror the indicator to an outsourced job.
See it in Fieldmotion
CRM1
Send a job report using the report-email dialog. widgetSendEmail.js and jobMail.js invoke Job_setPdfSent after Job_emailReport returns without error. Filter for both requests to distinguish sending from marking.
CRM2
Send a job report from the email dialog. widget/widgetSendEmail.js calls Job_setPdfSent after its Job_emailReport response; the marker alone is not delivery evidence.
Related endpoints
Jobs_getSomelets callers re-read the stored marker after the report workflow.