When it comes to the SOAP Api, it exposes among its headers EmailHeader which can be used to trigger email sent when a case is created via API.
By default, when a case is created via API, the case emails are not sent. However, while the SOAP Api exposes among its headers EmailHeader which can be used to trigger email sent when a case is created via API, there is nothing like that with the REST API.
How to trigger email when creating a case via REST API?
Best Answer
The same way you cause emails to be sent when you create a
Case
through any other Apex, by settingDMLOptions
.There is documentation on setting DMLOptions, but the highlights of that page are...
If you also have auto-assignment rules for cases that are created, you may need to set another DML option
AssignmentRuleHeader.useDefaultRule
.If you're only working with a single case, you can use the
setOptions()
method of the SObject class to actually set the dml options.For lists of SObjects, you'd need to use the
database.<dml method>()
method instead of just[insert|update] <list of SObject>;
. That method only exists for insert and update (not delete, undelete, or upsert)