Case Assignment Rules triggering
Sooooooooo - Case Assignment Rules (I'll abbreviate this to CAR) don't actually trigger automatically and never do.
To trigger an assignment rule, a user must ALWAYS select "assign using active CAR".
The thing is, you can both hide this checkbox, and set it to TRUE by default.
So the user thinks they saved a case, but in effect they used a CAR MANUALLY.
What's fun is that when you load data, sometimes you need to process Assignment Rules. In the dataloader, this is done by specifying, manually, the assignment rule ID that you want to trigger. This can only be done by the Salesforce Data Loader as far as I know. Added fun !
So what does this have to do with your case ?
Turns out the ONLY way to trigger CAR on a case programmatically is with a trigger. You can't do it with a flow. You can't do it with a process builder. You just need to use DML.Opts.
A VERY simple trigger I copied from a Salesforce Board some time ago is below. Note that using this out of the box is bad. You want a dev to go over it and check your use case, as well as existing automations. Also you may notice that this is not best practice because everything is in a trigger. Short version this is an EXAMPLE and should NEVER be used in production.
trigger CaseTrigger on Case (after insert) {
Set<Id> caseIdSet = new Set<Id>();
for(Case c : trigger.new) {
caseIdSet.add(c.Id);
}
List<Case> caseList = new List<Case>();
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.AssignmentRuleHeader.useDefaultRule = true;
for(Case c : [SELECT Id FROM Case WHERE Id IN: caseIdSet]) {
c.setOptions(dmo);
caseList.add(c);
}
update caseList;
}
anyway this will be the case for:
- community cases
- any whatever case that is created programatically.
No Comments