When to use this endpoint

Use JobType_setNotificationEmail from either Job Types settings screen when assigning or clearing the type-specific address.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.

The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesExisting positive job-type ID.
valStringYesAddress after trimming. A blank string clears it; a nonblank value must pass PHP email validation.

Example request

$result = FM_api('JobType_setNotificationEmail', [
	'id' => '42',
	'val' => 'dispatch@example.com',
]);

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"}The ID integer-converts below one.
{"error":"missing parameter: val"}val is absent or null.
{"error":"invalid parameter: val"}A nonblank trimmed value is not a valid email address.
{"error":"job type does not exist"}No type matches the ID.

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

Behaviour and edge cases

  • An equal trimmed value is a no-op. Invalid or non-object metadata is replaced with an object; otherwise unrelated keys are preserved.
  • CRM1 and CRM2 notification-template settings read this address when showing job-type-specific template rows.
  • The setter itself sends no message, creates no template mapping, and does not validate that notification rules use this type.

Side effects

  • On change, writes meta.notification_email, updates last_edited, and advances the job-type cache marker.
  • This focused setter writes no generic field-level audit entry.

See it in Fieldmotion

CRM1

Open Settings → Job Types and edit the envelope/address in the Notifications cell. CRM1 calls this endpoint.

CRM2

Open Settings → Job Types and edit the address in Notifications. CRM2 also calls this focused endpoint.

Related endpoints