0

We have some Email-to-Case routing emails that use the On-Demand method and some that use the Email Agent method. It seems that the email from the Email Agent have their assignment rules run each time a new email comes in with a ref:foo_bar:ref. However, the On-Demand emails only have Assignment rules run the first time.

  1. Send email to Email Agent.
  2. Agent creates new case, assigns to a queue.
  3. Reassign case to a User.
  4. Send email from case "To All."
  5. Reply to case with ref intact.
  6. Case will be reassigned from User to Queue.

    WF_RULE_EVAL_BEGIN|Assignment ... WF_CRITERIA_BEGIN|[Case: 01577124 5007000000klw4G]|Email-to-Case|01Q70000000EYyV WF_RULE_ENTRY_ORDER|6 WF_RULE_FILTER|[Case : Case Origin equals Retail Services] WF_RULE_EVAL_VALUE|Retail Services WF_CRITERIA_END|true WF_SPOOL_ACTION_BEGIN|Assignment

The On-Demand assignment rules only run when the email has no reference thus being a new case.

  1. Send email to On-Demand.
  2. On-Demand gateway creates new case, assigns to a queue.
  3. Reassign case to a User.
  4. Send email from case "To All."
  5. Reply to case with ref intact.
  6. Case will remain assigned to User.

    WF_RULE_EVAL_BEGIN|Assignment WF_SPOOL_ACTION_BEGIN|Assignment WF_ACTION|. WF_RULE_EVAL_END

I see no difference in the Routing Address settings. All Cases go through the same Assignment Rules. Is this expected? Is one misconfigured?

  • this may be of some help: success.salesforce.com/answers?id=90630000000hDU4AAM – cropredy Aug 19 '14 at 2:47
  • That's me posting the solution there. Thing is, it's an elaborate solution to a simple problem. My question here is, "What is the intended behavior. Shouldn't both work the same?" – mrBlaQ Aug 19 '14 at 15:30
  • I agree, the only thing I could think of was the Email Agent uses the DMLOptions in the header to define that assignment rules should run on every case update whereas on demand E2C does not run assignment rules except on insert. But when I looked through the E2C Agent Java code (cursorily, I'll admit) I did not see this. – cropredy Aug 19 '14 at 18:29
0

I was having trouble with something similar to this, and came up with a way to force assignment rules to run using a trigger on EmailMessage Insert where Incoming = True.

This is achieved by doing an update DML operation with only the ID specified, so that no fields are modified, while also specifying that the Assignment Rules be run using Database.DMLOptions.

trigger EmailMessage on EmailMessage (after insert) {
    List<Case> casesToAssign = new List<Case>();
    AssignmentRule ar = [SELECT Id FROM AssignmentRule WHERE SObjectType = 'Case' AND Active = true LIMIT 1];
    Database.DMLOptions dmlOpts = new Database.DMLOptions();
    dmlOpts.AssignmentRuleHeader.AssignmentRuleId = ar.Id;
    for(EmailMessage e : Trigger.new) {
        if(e.Incoming) {
            Case c = new Case(Id = e.ParentId);
            c.setOptions(dmlOpts);
            casesToAssign.add(c);
        }
    }
    update casesToAssign;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.