Posts

Showing posts with the label case trigger

Running Case Assignment Rules From Salesforce Apex

Image
Hi All, We all know that Case Assignment Rule decides how cases are assigned to users or put into queues. We can create multiple assignment rules, but only one rule can be “ active ” at a time. We can trigger assignment rules by simply checking the “ Assign using active assignment rules ” checkbox under the Optional section of the Case creation page from  Standard UI . Or We can set it default true under the “ Layout Properties “of the case page layout. But do you know!!! When we are inserting the Case via Apex, the assignment rule will not be triggered   as there is no such field “ Assign using active assignment rules ” to be checked in the Apex. DON’T WORRY . Here in this blog you will know how to run assignment rule through apex. //Fetching the assignment rules on case AssignmentRule AR = new AssignmentRule(); AR = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1]; //Creating the DMLOptions for "A...