Jobs: reports, email and links
Email the stored job attendees
/a/Job_attendeesEmailSend
Send job-created-style emails to the recipient list already stored on a job.
When to use this endpoint
Use this notification helper after saving attendees on the job. Job_new and Job_save call it internally; it does not accept a new attendee list or save job details.
It is different from emailing the completed report: use Job_emailReport for that workflow.
Authentication and permissions
Signed API-key authentication or a logged-in CRM session is required. The handler uses the authenticated tenant and has no additional role/page check.
The dispatcher also applies user/account and IP restrictions. CRM sessions carrying a CSRF token must supply X-FMCSRF or _csrf; missing or incorrect tokens can be rejected before the handler runs.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Positive physical job ID; the job must not be deleted. |
template_id | Integer string | No | Defaults to 0: resolve job_created notification templates. A nonzero value overrides that selection; only positive template IDs select the stored attendees email body. |
trigger_event | String | No | Internal audit-source override, default Job_attendeesEmailSend. Job_new and Job_save supply their own names. It does not select notification settings. |
Example request
$result = FM_api('Job_attendeesEmailSend', [
'id' => '1042',
]);
Example response
{"ok":1}
Returns {"ok":1,"msg":"no attendees listed"} for missing/empty attendees.emails. Disabled notifications return an error. For attempted recipients, ok requires a positive queue acknowledgement; it is not delivery confirmation and can also mean every invalid entry was skipped.
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 or nonpositive id. |
{"error":"job does not exist"} | The job is missing or deleted. |
{"error":"attendees email not sent. please check form and type"} | The effective tenant/form/Job Type notification gate is disabled. |
{"error":"Job email queue response was not confirmed. Check mail history before retrying."} | Mail failed or returned an ambiguous acknowledgement. Earlier recipients may already be queued; do not repeat automatically. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Reads the stored attendees JSON object: emails is a native list; email is the body used with a positive template. Entries such as 12:Engineer resolve a tenant user ID; other entries must pass PHP email validation. Missing user addresses and invalid literal addresses are skipped. User addresses are not separately syntax-validated, and recipients are not deduplicated.
- Notification enablement starts with disable-job-notification, then form meta.send_notification, then Job Type meta.send_notification. At each object level 0/missing inherits, 1 disables and 2 enables; the Job Type wins over the form.
- When template_id is omitted/zero, notification_types.job_created.enabled=1 permits the configured template and form-based default; the last numerically matching form override wins. The enabled flag here controls template selection, not the separate notification gate.
- Asset jobs resolve the customer from a customer-type asset location when present, otherwise its owner. Default text includes job date, reference, notes and customer details; positive-template mode uses the stored attendees.email instead.
- No pagination, recipient limit, completion requirement or extra role check is implemented. Malformed stored attendee/notes shapes are not comprehensively validated.
Side effects
- Makes one type-2 Core_mail request per accepted recipient, with job_created source metadata. It does not write job state or add an explicit job-history row.
See it in Fieldmotion
CRM1
There is no direct browser caller. Create or save a job with attendees; Job_new / Job_save trigger this helper server-side. Filter those requests in Network; the helper is not a second browser request.
CRM2
No direct route caller was found in CRM2. This is the legacy attendee-notification path, not the CRM2 report email dialog.
Related endpoints
Job_emailReportemails generated job documents.Job_setNotessaves notes before its separate change-notification helper.