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 Declarative WebhooksAdministration tab of the Declarative Webhooks app under the Scheduled Jobs subtab.
Select the + button to create a new job and provide the following:
- Job Name = The name of the job. Select something easily recognizable and representative for the schedule job.
- Schedule Cron Expression = When and how often to run.
- A CRON expression is defined as a string of fields separated by white spaces that represents a set of times. View more details about CRON expressions here: https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm
- If you need help creating an expression, here’s a helper website: https://crontab.cronhub.io/
- Callout Template = Select your Callout Template
- Only active callout templates are available
- Batch Size = Select how many records the job will use in each call
- This input appears only if the selected template has Number of Callouts set to “Multiple Records”.
- If you choose a template where you selected “One Record” as the Number of Callouts, then the input will be hidden and the job will always run the callouts one-by-one for each record.
- Filter Records = Filter the records to be included
- Leave this empty if you want to include all records
- Complete the SOQL query if you want to filter records (i.e Status = ‘New’)
- If you only need to limit or order records, you also need to add a condition. You can use something like Id != null ORDER BY CreatedDate DESC LIMIT 1
Your New Scheduled Job may look something like this:
After you save your scheduled job, you will see the details on the page.