function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
arunadeveloperarunadeveloper 

How to check Assign using active assignment rules check box on Case object using trigger

Hi thete,

 

I have requirement when case is updated i need to show "Assign using active assignment rules" check box is checked.

I was looking at couple of blogs i found below solution .

 

 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); 

 

but it not showing "Assign using active assignment rules" checked.

Can any one tell me how to check "Assign using active assignment rules" check box . it is possible ?

Ganesh03Ganesh03

Hi Aruna,

 

The code snippet you mentioned is required when you are creating case from apex.

 

If you are opening a case by user navigation through salesforce, it is not required.

 

Could you please elaborate your problem in more detail.

 

Thanks,

arunadeveloperarunadeveloper

ok, I am having a custom button on Case.

 

when i click that button i need to update some fields and also check the "Assign using active assignment rules" this check box automatically.

 

I am able to update the fields but enable to check this check box "Assign using active assignment rules".

 

Could you please suggest me how to check "Assign using active assignment rules" using apex class or trigger.

 

Thank you.