• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Apex Scheduler

Apex Scheduler in Salesforce

Apex scheduler is helpful to invoke apex classes to run at specific times, first implenent the “schedulable” interface for the class, then specify the schedule using either the schedule apex page in the salesforce user interfaces, or the system schedule method.

Note:- Salesforce only adds the process to the queue at the scheduled time actual execution may be delayed based on service availability.

We can only have 25 classes scheduled at one time we can evaluate current by viewing the scheduled jobs page.

Go to the following path to view the scheduled jobs.

Your Name —> Setup —> Administration setup —> Monitoring —> Schedule Jobs

Aspired to become an Salesforce? Explore the post to discover the know-hows on Salesforce Training Manual.

Implementing the Schedulable Interface:-

To schedule an apex class to run at regular intervals, first write an apex class that implements the interface schedulable (Salesforce Provided) The Schedulable interface contains one method that must be implemented “execute”

EX:- Global void execute (Schedulable Context sc) {
 }

The following example implements the schedulable interface for a class called helloworld

EX:- 

Global class schedule helloworld implements schedulable { global void execute
 (schedulable context sc)
 {
 Helloworld hw = new helloworld ( ) ;
 }
 }

To schedulable jobs using the apex scheduler:-

Click your Name → setup

Apex classes

  • Click on schedule apex button
  • Specify the name of a class that we want to schedule
  • Specify the how often the apex class is run.

For Weekly → Specify one or more days of the week the job is to run ( such as Monday and Wednesday )

For Monthly → Specify either the date the job is to run or the day ( such as second Saturday of every month) Specify the start and end dates for the apex scheduled class. If we specify a single day the job only runs once.

  • Specify a preferred start time. The exact time the job starts depends on what jobs are in the queue at that time.
  • Click “Save” button.

Standard Apex Schedular with Account Creation Class :

global class CreateAccountSchedule implements Schedulable
 {
 global void execute(SchedulableContext SC)
 {
 Account_Creation ac = new Account_Creation();
 ac.Create_Account('Osmania University', '9052');
 }
 }

For indepth understanding of Salesforce click on

Summary
Review Date
Reviewed Item
Apex Scheduler
Author Rating
5

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Apex Scheduler"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.

    Support


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.