Skip to main content
9 events
when toggle format what by license comment
May 11, 2016 at 5:23 comment added Ashu NCS code for the above question is followingList<Case> cases; // Contains new and existing cases //This will be set from the UI based on whether the auto assignment of case should happen or not Boolean useDefaultRule; Database.DMLOptions options = new Database.DMLOptions(); options.assignmentRuleHeader.useDefaultRule = useDefaultRule; List<Case> caseList = new List<Case>(); for(Case case : cases){ case.setOptions(options); caseList.add(case); } upsert caseList;
May 11, 2016 at 5:22 comment added Ashu NCS @sfdcfox I am creating cases in an APEX function and this also received a boolean to allow default rules to run or not. Now in the same function while adding a new or existing case to upsert in the end, I am setting options to each with the flag value but this is not honored and always the rules run even when the flag is false. Could you tell me if I am doing anything wrong here?
Jul 29, 2014 at 15:35 vote accept Matthew Mitchener
Jul 29, 2014 at 15:35 comment added Matthew Mitchener 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!
Jul 29, 2014 at 15:14 comment added Matthew Mitchener 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.
Jun 16, 2014 at 16:25 comment added cropredy sorry, I guess I more broadly interpreted OP's: 'we trigger' as not necessarily meaning 'we invoke a trigger'
Jun 15, 2014 at 7:54 comment added sfdcfox @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.
Jun 14, 2014 at 9:46 comment added cropredy note also that DmlOptions can also be set by an API client if Cases are being created by the WuFoo system
Jun 14, 2014 at 2:49 history answered sfdcfox CC BY-SA 3.0