I have the following in my method called in after insert part of trigger.
public void caseAssignment(List<Case> cList){
List<Case> cListNew = new List<Case>();
AssignmentRule AR = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1];
Id intId = [Select Id from user where name ='API User'].id;
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id;
for(Case c : cList){
if(c.ownerId == intId && c.Source_Type__c != ''){
c.setOptions(dmlOpts);
cListNew.add(new case(Id = c.id));
}
}
system.debug('enterthedragon'+cListNew);
database.update(cListNew);
}
But case owner is not changed to queue as defined in case assignment rules. system.debug is printing clistnew wit case id.