When to use this endpoint

Use File_setIncludeInMailReport from Job/related file options when the report-email workflow should attach this file.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session and establish the tenant database context.

The handler performs no record-owner or resource-specific permission check. CRM screens may hide the action, but callers with tenant API/session access can target any matching file ID.

Parameters

ParameterTypeRequiredDescription
idInteger-compatibleYesPositive file ID.
valInteger-compatibleNoTruthy stores meta.include_in_mail=1; false/absent removes the key.

Example request

$result = FM_api('File_setIncludeInMailReport', ['id' => '4821', 'val' => '1']);

Example response

{
  "ok": 1
}

Errors and unusual responses

ResponseCondition
{"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 non-positive.
{"error":"file not found"}The ID does not identify a live file.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Malformed legacy metadata is normalized before the flag is changed. The update does not change last_edited or create an audit record. It affects later email assembly only when that workflow reads the flag.

See it in Fieldmotion

CRM1

Toggle attach/include in emailed report on Job, Task, or shared file tables.

CRM2

Job/file option menus call this route for the emailed-report switch.

Related endpoints