You are here:
Schedule a Batch Job
Use a schedule-triggered flow to schedule your bulk policy renewal jobs to run automatically at a specified time and frequency. Make sure that each job run uses a unique identifier for easier monitoring of the policy renewal process. Schedule a custom Apex action by using the same approach.
- In Setup, find and select Flows.
- Click New Flow.
- Select Schedule-Triggered Flow.
- Set the start date, time, and frequency for the job.
-
Create a formula resource to generate a unique jobIdentifier for each run.
- Select Formula as the resource type.
- Enter an API name.
- Select Text as the data type.
-
Consider these strategies based on how frequently jobs are triggered.
Format Description PolicyRenewal_<unixtimestamp> Unique if only one job is created per second. PolicyRenewal_<unixtimestamp>_<last 4 chars of Flow.InterviewGuid> Unique for multiple jobs created per second. PolicyRenewal_<Flow.InterviewGuid> Unique for all jobs. The last four characters of Flow.InterviewGuid isn't often unique, so they must not be used as a standalone identifier. -
Enter this formula.
"PolicyRenewal_" & TEXT(UNIXTIMESTAMP(NOW())) & "_" & RIGHT({!$Flow.InterviewGuid}, 4)- Length of unixtimestamp is 10 characters.
- Length of Flow.InterviewGuid is 43 characters.
- Add the Action element to your flow.
-
In batch job actions, select your batch job
definition.
This batch job is used as an invocable action to be called when the scheduled flow runs.
- Pass all the required batch job parameters to this action, including a unique jobIdentifier.
- Save and activate the batch job.

