My question is nearly identical to an existing question. To summarize the problem, my case owners aren't receiving an e-mail notification when a new comment is added to their cases. Please view the linked question for the pretty pictures which further describe the issue.

However, the difference between our questions is that I'm creating a case via the REST API (not SOAP). How do I set these magical DML Options? Is it even possible, or are users stuck with one of three workarounds (that I can think of):

  1. Create a workflow e-mail alert (I would vote for this option)
  2. Write an Apex Trigger that hooks into the insert
  3. Use the SOAP API and set the option (not practical if already using the REST API)
  • I dont know whether its possible to set DML options in REST but one way i would solve is use apex trigger and set the DML options in triggers .The data from REST will go through this trigger .Hope this trick is worth trying Aug 29, 2014 at 3:36
  • @MohithShrivastava do you have to do it on an update or can you set dml options in a before trigger? Aug 29, 2014 at 7:10
  • developer.salesforce.com/forums/… It has to be after trigger Aug 29, 2014 at 10:15
  • @Justin Just wondering how you solved this issue. Care to share please?
    – ysrb
    Jun 27, 2015 at 11:48

2 Answers 2


Have you tried using the SForce-Auto-Assign Assignment Rule Header?

The Assignment Rule header is a request header applied when creating or updating Cases or Leads. If enabled, the active assignment rules are used. If disabled, the active assignment rules are not applied. If a valid AssignmentRule ID is provided, the AssignmentRule is applied. If the header is not provided with a request, REST API defaults to using the active assignment rules.

There doesn't appear to be an equavalent emailHeader. So this probably won't be sufficient.

Another possible work around - You could use Apex to implement your own REST API that already includes the required DMLOptions.


global with sharing class CaseRestResource {

    global static String doPost(String subject) {
        Case newCase = new Case();

        newCase.Subject = subject;
        // Set AccountID, etc...

        Database.DMLOptions dmo = new Database.DMLOptions();
        dmo.emailHeader.triggerUserEmail = true;
        dmo.assignmentRuleHeader.useDefaultRule = true;

        insert newCase;
        return newCase.Id;
  • While the custom API endpoint is an interesting idea (+1 for that!) if I went down that path I feel like I might as well just write a trigger to handle it as opposed to changing my code to point to a non-standard REST API resource. Sep 3, 2014 at 4:25
  • OK. No problem. Either you or @MohithShrivastav could post that as the actual answer if you like. Sep 3, 2014 at 10:24
  • I'm going to give it a few more days to see if any other answers happen to trickle in. Thanks for your help! Sep 3, 2014 at 16:11
  • The SForce-Auto-Assign Assignment Rule Header worked for me, thanks. I corrected the broken docs link.
    – Alphaaa
    Jul 22, 2019 at 13:29

I ended up creating my own workflow rule to e-mail the case owner (option #1 in my original question).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .