Scheduling a new job in Salesforce is a very common and often task for both Developers and Administrators. The reasons may be different, for instance:
- some long-running periodic processes like nightly processing of leads, monthly calculations of summaries, etc,
- some short-running processes that need to happen very often, like processing new records every 5 or 10 minutes, etc,
- an existing job to execute only one time in order to check something or to process some legacy or new data.
The Welkin Suite offers you an easy and cozy way to accomplish all these tasks even without any Apex code line written. Use the Scheduled jobs panel that has all the necessary options represented in a friendly UI.
Scheduled jobs panel
To open the Scheduled jobs panel, navigate to the Main Menu:
View ⇒ Scheduled Jobs.
In this panel, you can see the list of jobs that you've already scheduled on an org. Thanks to this, you don't need to open a browser to quickly check if there's something you're already looking for in the schedule already. Also, here you are able to find all the related to the scheduled jobs information in a table view:
- Job Name — the jobs are bundled by projects,
- Submitted by — an author of a job,
- Submitted Date — a date of a submission a job,
- Started — time when a job was started,
- Next Scheduled Run — time, when a job will be run next time,
- Type — a type of a job,
- Status — the current status of an executing of a job,
- Expression — an expression of a job,
- Start time — time, when a job should be started,
- End Time — time, when a job should be ended,
- Times Triggered — how many times a job was triggered,
- Time Zone — a time zone of a job.
You have an ability to set the visible columns in the Scheduled jobs panel. You can hide the columns that currently don't provide any useful information for you. Click on the Configure columns button and check the necessary columns in the list.
These settings apply to a single session in TWS, so if you close the program and then re-open it, all the changes you made to the column visibility will be restored to default
To find the data that you need in all the jobs you can use filters in the header of each column, or you may sort data in ascending or descending order by clicking on a column's header.
In order to get the freshest list of scheduled jobs on an org, click on the Refresh Jobs button. You can also set the auto-refreshing to have the updated list of jobs anytime. To do so, click on the Settings button in the Scheduled Jobs panel, set the preferable period of refreshing, and click the Apply button.
Create a new scheduled job
To create a new scheduled job, select a project you need and then use one of the following ways:
- click on the New button at the top of the panel,
- or select the Create new scheduled job from the context menu of a project
In the opened window you can find all the necessary settings for creating a new job.
Namely, the process of creation of a new job includes such settings:
- Job Name — a required field for the job name,
- Apex Class — a dropdown list where you need to select the Apex class that will be executed; in this list you will find all the Apex classes from your TWS project, which implement the Schedulable interface,
- Preferred Start Time — time, when the job will be executed for the first time,
- Execution schedule — a block with details about the executions schedule,
- Apex code — a text field where you can find generated Anonymous Apex and Cron expression(s) are used for scheduling a configured job (or jobs).
The IDE provides you with the following options for configuring a job's schedule:
- Run — after selecting this option you can choose one of the 3 child options: run once at a preferred start time, run now, and run every
Xminutes, hours, or days.
NB: If you select running a job every
Xminutes, the IDE will create multiple scheduled jobs (being more precise,
Xjobs), however, this is a very good option when you are going to execute your class very often.
- Weekly — using this option allows you to schedule your job to be executed every weekday, weekend, or on certain days of the week.
- Monthly — it provides you with an ability to execute your job every month on certain days, like the 14th of every month, or for example, every second Monday and Thursday.
- Advanced — you can use this option to configure your own schedule for a job using a Cron expression.
In addition, in the Scheduled Jobs panel, you have an ability to Delete an unnecessary job — select a job and click on the appropriate button at the top of the panel. This option is also available from the context menu of a job.
Also, you can view a job in a browser. For this, use the Open in browser option from the context menu of a job. After clicking on this menu item, the IDE will open your browser, with the selected Scheduled Job, so you can examine its details and parameters.
In this section:
This also may be useful: