You need to sign in to do that
Don't have an account?
Sachin_K
Accessing "Assign using active assignment rules" option of case object from trigger
Hi,
We have a "Assign using active assignment rules" option at the bottom whenever we create a new case. We can chose a default value for this option from the page layout. Can we also access or set it through a trigger on case object. I tried finding the field name for this field, but got none.
Please let me know, if someone knows about this field.
Thanks,
Sachin
Sachin,
Assignment rules for cases and leads are stored in a separate object, "AssignmentRule" -- see:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_assignmentrule.htm
You can assign (or not) a case according to the related, active assignment rule by using the "Database.DMLOptions" object -- see:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_database_dmloptions.htm
All Answers
Sachin,
Assignment rules for cases and leads are stored in a separate object, "AssignmentRule" -- see:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_assignmentrule.htm
You can assign (or not) a case according to the related, active assignment rule by using the "Database.DMLOptions" object -- see:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_database_dmloptions.htm
Thanks a lot. That was helpful
//Variable decleration
List<Case> caseList = new List<Case>();
User integrationUserObj = new User();
if(Trigger.isAfter && Trigger.isInsert){
//Fetching the integration user details
integrationUserObj = [SELECT Id, Name FROM User where Name = 'Balaji Bondar' LIMIT 1];
for (Case caseObj : Trigger.new) {
if (caseObj.OwnerId == integrationUserObj.Id) {
caseList.add(new Case(id = caseObj.id));
}
}
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
Database.update(caseList, dmo);
}
}