Implementing a Callout From a Scheduled Batch
Schedule a callout to run periodically
You have the option to schedule your callout based on a time of your preference. This can be set up within the Administration tab of the Declarative Webhooks app under the Scheduled Jobs subtab.
Select the New Schedule Job button and provide the following:
- Name = Your Choice
- Schedule Cron Expression = Schedule of Run
- A CRON expression is defined as a string of fields separated by white spaces that represents a set of times; check out the link here that explains this in further detail
- Callout Template = Select your Callout Template
- Batch Size = Select your batch size/number or records
- If you choose a template where you selected One Record as the Number of Callouts, then Batch Size will always be 1. Therefore, the batch will run the callouts one-by-one for each record. If you select a template where Number of Callouts is Multiple Records, then you will see the Batch Size Options as 1-2000.
- Select ID FROM account WHERE = Leave this empty if you want to include all records; use a SOQL query if you want to filter records.
Your New Scheduled Job may look something like this:
After you save your scheduled job, you will see the details on the page.
The column headers are defined as:
- Name: The Name of your schedule job
- Callout Template: Displays the template used in the scheduled job
- Batch Size: The number of records that will be sent in each call of the scheduled job
- Cron Expression: The scheduled CRON syntax of when your scheduled job will run
A CRON expression is defined as a string of fields separated by white spaces that represents a set of times; check out the link here that explains this in further detail.
- Job Fired Count: Total number of times this schedule job has ran
- Next Run Time: Next future run of the scheduled job
You can also edit some of the details of the scheduled job by clicking the edit button, except for the cron expression. If you need the job to have a different schedule, remove the job and schedule again.