4

We have third party form builder tool called Wufoo that creates records on a custom object when a form is submitted. If certain criteria applies, we trigger a case creation and specify who the case owner is.

However, after the Case is created and assigned. Salesforce will auto-assign the Case to the "Default Owner" found in Build > Customize > Cases> Support Settings.

As you can see below the correct owner is assigned, but Salesforce will reassign the record: enter image description here

To try debugging the issue, I created a case manually and Salesforce will not override the owner.

Does anyone have any suggestions for how I can assign my Case a new owner without Default Owner overriding this?

4 Answers 4

4

When creating cases from a trigger, you can specify DMLOptions to prevent the assignment rules from firing. Something like this:

trigger X on Y (after insert) {
    Case[] cases = new Case[0];
    for(Y record: Trigger.new) {
         if(someCondition) {
             cases.add(new Case(...));
         }
    }
    Database.DMLOptions options = new Database.DMLOptions();
    options.assignmentRuleHeader.useDefaultRule = false;
    cases.setOptions(options);
    insert cases;
}

I haven't personally used DMLOptions before, so you may need to tweak this answer a bit.

7
  • note also that DmlOptions can also be set by an API client if Cases are being created by the WuFoo system
    – cropredy
    Commented Jun 14, 2014 at 9:46
  • @crop1645 True, except this question specifically says they are creating the records via triggers, so this is the answer I provided. It is true that WuFoo could control this if they were creating cases directly, which appears to lot be the case.
    – sfdcfox
    Commented Jun 15, 2014 at 7:54
  • sorry, I guess I more broadly interpreted OP's: 'we trigger' as not necessarily meaning 'we invoke a trigger'
    – cropredy
    Commented Jun 16, 2014 at 16:25
  • Sorry for the late reply. I tried this and get the following error: Method does not exist or incorrect signature: [LIST<Case>].setOptions(Database.DMLOptions) (Line: 51, Column: 9). To elaborate, this code is written in a Trigger. Commented Jul 29, 2014 at 15:14
  • Figured out that I could add the option to individual Case record instead of the LIST<Case>. Looks like it is working fine now. Thanks! Commented Jul 29, 2014 at 15:35
1

Try the following:

  1. Write a Case assignment rule that executes first - criteria = if case originated from WuFoo.
  2. Assign to any active user
  3. Check the box 'do not reassign owner'

see for example - https://developer.salesforce.com/forums/ForumsMain?id=906F00000008zGWIAY

1

I had the same issue recently; and this is how it works for me:

  • Leave the default owner in the support setting.

  • Create an assignement rule that affect your cases to another specific user,unlike the default one (for example a system admin)

  • Fire your trigger CaseBeforeUpdate,with a criteria based on the last owner which is the one assigned by the assignement rule.

-1

Sforce-Auto-Assign: FALSE add it in header while making a call to salesforce. Please refer

You must log in to answer this question.

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