I have a scenario where Case Owner is changed only using Apex code, rather than through assignment rules + default owner. We've been able to make it work for a couple of different Case creation scenarios.
However, when using email-to-case (at least on-demand) the assignment rules + default owner are applied.As this happens after the Apex code we use (an after insert trigger), the Case Owner gets overridden.
We have implemented a workaround, using a "dummy" assignment rule. It works, but it's not a very nice solution. We have some other ideas, but they may require more effort.
We'd like to understand our options. Is it possible to prevent the assignment rules + default owner from being applied in the first place when using email-to-case?
Best Answer
I've solved this as follows
Bypass_Assignment_Rules__c
to true for those use cases where assignment rules should be bypassed.Bypass_Assignment_Rules__c = true
and assign to a "in-transit queue"ownerId = inTransitQueueId
and then do the assignment as you desire while also turningBypass_Assignment_Rules__c
to false.