You need to sign in to do that
Don't have an account?
AvisheK
Case Assignment Rule not firing through Apex Code after Winter 10 release in sandbox
Hi,
I have written an Apex Trigger which would automatically make the Case Aggignment Rule fire upon update of records either through front or back end using the AssignmentRuleHeader. This trigger was firing properly in the sandbox before the Winter 10 release came into effect. This code is still firing properly in Production which has not yet been upgraded to the Winter 10 release.
If anyone has faced a similar issue, and found a resolution, please provide me the same.
Thanking you in anticipation,
AvisheK
My trigger on the case object is already an after update trigger. I am taking the Id of the case and excuting a SOQL statement to pick populate a list with the Cases.
The code that I am using is provided as below.
List<Id> str_ID=new List<Id>{};
for(Case c:Trigger.new) {
str_ID.add(c.Id);
}
if (runAssignmentRule.isRun<>true) {
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
List<Case> lst_Case=[select id,OwnerId,Change_Owner__c,RecordType.Name,Market_Origin__c from case where id in:str_ID];
runAssignmentRule.setIsRun();
for (Case c:lst_Case)
{
if (c.RecordType.Name.contains('Investigation') || c.RecordType.Name.contains('Client Close') || c.RecordType.Name.contains('Staff Account Setup') || c.RecordType.Name.contains('Trader Call Program') || c.RecordType.Name.contains('Complaint') || c.RecordType.Name.contains('Collections') || c.RecordType.Name=='Compliance' || c.RecordType.Name.contains('Awaiting Funds') || c.RecordType.Name.contains('Maturing Contracts') || c.RecordType.Name=='File Review' || c.RecordType.Name.contains('FXOPS PQ') || c.RecordType.Name.contains('Salesforce Issues') || c.RecordType.Name.contains('Refund') || c.RecordType.Name.contains('Query') || c.RecordType.Name.contains('Change of Bank Details') || c.RecordType.Name.contains('Return of Funds') ) {
} else {
if (c.Change_Owner__c==false) {
c.setOptions(dmo);
}
}
}
try {
update lst_Case;
}catch(Exception ex) {
system.debug('%%%%%%%%%%% Error :' + ex.getMessage());
}
}