Posts

Showing posts with the label Salesforce Apex 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...

CRON Expression in Salesforce

Image
Hello to all the Salesforce developers, here in this blog I am covering a very crucial topic that we all use in our coding skills - CRON expression. As we all know that Salesforce provide us a very great feature of Scheduling an apex class. In standard way through customization part, we can schedule an apex class with frequency of weekly days or monthly dates with a preferred start time. But through CRON expression we can schedule an apex with our customized date time or occurrence through code. That’s an interesting feature that Salesforce allows developers to customize according to their own need and scenario. What is CRON? CRON is  a software utility that is a time-based job scheduler in Unix-like computer operating systems. Developers who want to set up and maintain software environments, use this cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. What is CRON expression? A CRON expression is basically a s...