You need to sign in to do that
Don't have an account?
kfm2012
Case Assignment Rules
We are starting to use Cases to track customer questions/issues in SalesForce. By default, the Case Owner is set to the logged in user. If certain users enter a Case, we want it to automatically be assigned to a Queue (call it TestQueue). I set up a case assignment rule that looks at 'Case: Case Owner' and if it is equal to myself, it should reassign the case to 'TestQueue'. I've also tried setting 'Case: Case Owner' is not equal to some dummy value and I can't get the case to automatically be assigned to the queue. Any guidance would be appreciated. thx
List<Id> caseIds = new List<Id>{};
for (Case c:trigger.new)
caseIds.add(c.Id);
List<Case> listCase = new List<Case>{};
for(Case cse : [Select Id from Case where Id in :caseIds]){
AssignmentRule AR = new AssignmentRule();
AR = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1];
//Creating the DMLOptions for "Assign using active assignment rules" checkbox
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id;
cse.setOptions(dmlOpts);
listCase.add(cse);
}
update listCase;
Please mark it as resolved, if it helps you.
Cheers
Sanj
All Answers
Hi,
Follow below steps to set case owner:
1. Click on Customize.
2. Case
3. Go to Support Settings.
4. Under "The default owner of a case when assignment rules fail to locate an owner." Select Queue from Picklist and search for the Queue that you have created through lookup. and click on save.
Once you are done with the same, test it.
Please mark as resolved if it helps you. Do let know if any issue.
Cheers
Sanj
thanks, appreciate the help but that didn't do the trick. For some reason, i can't get the Case Assignments Rule to fire at all. For example, right now I have 1 Case Assignment Rule set up and it's Active. It has one rule that is set up as 'Run this rule if the following formula eveluates to true:' - In the formula, I have $User.Alias <> "xxxxxx". I have it set to Queue - Cashiering. No matter what formula I try, the Case owner is always the logged in user. Any ideas? thx
Hi,
If your assignment rule is not getting fired. Try below code snippet in a after insert trigger to execute the assignment rule.
//Fetching the assignment rules on case
List<Case> cse= new List<Case>();
AssignmentRule AR = new AssignmentRule();
AR = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1];
//Creating the DMLOptions for "Assign using active assignment rules" checkbox
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id;
cse.setOptions(dmlOpts);
update cse;
Mark it as resolved if it helps else let know the issue.
Cheers
Sanj
thx for help. Can you please look at this error?
Error: Compile Error: Method does not exist or incorrect signature: [LIST<Case>].setOptions(Database.DMLOptions) at line 10 column 1
Here's my trigger:
trigger fireCaseAssignmentRules on Case (after Insert)
{
//Fetching the assignment rules on case
List<Case> cse = new List<Case>();
AssignmentRule AR = new AssignmentRule();
AR = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1];
//Creating the DMLOptions for "Assign using active assignment rules" checkbox
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id;
cse.setOptions(dmlOpts);
update cse;
}
thanks again----
List<Id> caseIds = new List<Id>{};
for (Case c:trigger.new)
caseIds.add(c.Id);
List<Case> listCase = new List<Case>{};
for(Case cse : [Select Id from Case where Id in :caseIds]){
AssignmentRule AR = new AssignmentRule();
AR = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1];
//Creating the DMLOptions for "Assign using active assignment rules" checkbox
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id;
cse.setOptions(dmlOpts);
listCase.add(cse);
}
update listCase;
Please mark it as resolved, if it helps you.
Cheers
Sanj
worked, thx!
how did it work after you said regarding method error