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

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.

| improve this answer | |
  • note also that DmlOptions can also be set by an API client if Cases are being created by the WuFoo system – cropredy Jun 14 '14 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 Jun 15 '14 at 7:54
  • sorry, I guess I more broadly interpreted OP's: 'we trigger' as not necessarily meaning 'we invoke a trigger' – cropredy Jun 16 '14 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. – Matthew Mitchener Jul 29 '14 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! – Matthew Mitchener Jul 29 '14 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

| improve this answer | |
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.

| improve this answer | |
-1

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

| improve this answer | |

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.