You need to sign in to do that
Don't have an account?
![Rohit SharmaG Rohit SharmaG](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Enable Assign using active assignment rules via Backend
Hi Dears,
I want to enable Assign using active assignment rules via backend , not from pagelayout. please assist on this.
![User-added image](/forums/servlet/rtaImage?eid=906F0000000AerU&feoid=Body&refid=0EMF0000000QSDc)
I want to enable Assign using active assignment rules via backend , not from pagelayout. please assist on this.
AssignmentRule rules = new AssignmentRule();
rules = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1];
//Creating the DMLOptions for "Assign using active assignment rules" checkbox
Database.DMLOptions Opts = new Database.DMLOptions();
Opts.assignmentRuleHeader.assignmentRuleId= rules.id;
Case newCase = new Case(Status = 'New') ;
//Setting the DMLOption on Case instance
newCase.setOptions(Opts);
insert newCase