Loading

Send email options for DML operations carried out in the Apex code

게시 일자: Oct 13, 2022
솔루션

Even though auto-sent emails can be triggered by actions in the Salesforce user interface, the DMLOptions settings for emailHeader take effect only for DML operations carried out in Apex code.

This behavior can be controlled using the DMLOptions class during execution.  Here is an example of how this can be done.

Database.DMLOptions dlo = new Database.DMLOptions();
dlo.emailHeader.triggerUserEmail = true;

database.insert(tasksToCreateList,dlo);

The following are properties for DmlOptions.EmailHeader.

  • triggerAutoResponseEmail : Indicates whether to trigger auto-response rules (true) or not (false), for leads and cases.
  • triggerOtherEmail : Indicates whether to trigger email outside the organization (true) or not (false).
  • triggerUserEmail : Indicates whether to trigger email that is sent to users in the organization (true) or not (false).

DMLOptions

Knowledge 기사 번호

000385486

 
로드 중
Salesforce Help | Article