+ Start a Discussion
David CheungDavid Cheung 

Phantom behavior bug on invoking default Case assignment rule using DMLOptions useDefaultRule

I would like hear from anyone who may have had this similar experience with invoking the default Case assignment rule on in Apex. The Apex code would be something as follows:

Database.DMLOptions dmo = new Database.DMLOptions();

dmo.assignmentRuleHeader.useDefaultRule = true;

Case c = new Case(Status = 'New') ;


insert c;

The intention is to set the owner of the Case by invoking the business rules defined in the default assignment rule. If the assignment rule fails to locate an owner the default Case owner is set as the Case owner. The default Case owner is configured in Set Up / App Setup / Customize / Cases / Support Settings.

What do you think happens when the default assignment rule is inactive, e.g.: there are no active assignment rules? I thought the creator of the Case would be the owner of the Case, but not so, the behavior is such that as if phantom assignment rules are invoked and a owner is failed to be located resulting in the default Case owner being assigned as the owner. The same behavior is exhibited even when all assignment rules are deleted. The only way to remove the phantom rules is to remove the useDefaultRule call from the Apex code.

While I don't see a scenario where a business would completely stop using Case assignment rules after implementing them, I do see this as a probable classic bug. It looks like there is a switch statement behind the useDefaultRule call with a default block where the assignment of the default Case owner is occurring, and this default block is being reached because the condition of “no rules” is being treated same as the condition of ”no owner located”.
It is probably this bug:


I reported it almost a year ago and it took them forever to acknowledge it.  They tried to say it was expected behavior.