You are here:
Sequence Address Batch Jobs by Using a Flow
To make sure that address synchronization batch jobs run in the correct order, create a flow that automatically initiates the Process Provider Affiliation Addresses batch job only after the Process HCP Contact Point Addresses batch job completes.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise and Unlimited Editions with Life Sciences Cloud, Life Sciences Cloud for Customer Engagement Add-on license, and the Life Sciences Customer Engagement managed package. |
| User Permissions Needed | |
|---|---|
| To create a flow: | Manage Flow |
- From Setup, enter Flows in the Quick Find box, select Flows, and then select New Flow.
- In the New Flow window, select Platform Event - Triggered Flow.
- For Platform event, select Batch Job Status Changed Event and in Advanced settings, select Run this flow as the user that triggered the event.
-
Create a decision element that uses a record or answers from a screen input to determine a
flow path.
- On the flow canvas, add a Decision element.
- Enter a label and API name for the element, for example Is HCP Contact Point Addresses Batch Job Complete?
-
Give labels for the outcomes and enter these conditions.
Resource Operator Value Triggering BatchJobStatusChangedEvent -> Batch Job Equals Process_HCP_Contact_Point_Addresses’s BatchJobDefinitionId Example batch job definition ID: 0maxx0000000001AAA
Triggering BatchJobStatusChangedEvent -> Batch Job Does not Equal Cancelled - Click Done.
-
Create variables that store the batch job runtime parameters and make the value
available for output.
- From the toolbox, select Manager and then select New Resource.
- For Resource Type, select Variable.
- For API Name, enter batchJobRuntimeParameters.
- For Data Type, select Text.
- Select Available for output.
- Click Done.
-
Create a Get Records element to retrieve the HCP Contact Point Addresses batch job
details.
- On the flow canvas, add a Get Records element.
- Enter a label and API name for the element, for example Get Batch Job Record.
- For Object, select Batch Job.
- Under Filter Account Records Condition Requirements, select All Conditions are Met (AND).
- For Field, enter Id, then select Run ID.
- For Operator, select Equals.
- For Value, select Resource Triggering BatchJobStatusChangedEvent -> Batch Job.
- For How Many Records to Store, select Only the first record.
- For How to Store Record Data, select Choose fields and assign variables (advanced).
- For Where to Store Field Values, select In separate variables.
- For Field, select Runtime Parameter.
- For Value, select batchJobRuntimeParameters.
- Click Done.
-
Create these formulas to get the individual batch job runtime parameters.
API Name Data Type Formula extractedStartTime TEXT LEFT( MID( {!batchJobRuntimeParameters}, FIND('{"name":"startTime","value":"', {!batchJobRuntimeParameters}) + LEN('{"name":"startTime","value":"'), 50 ), FIND( '"', MID( {!batchJobRuntimeParameters}, FIND('{"name":"startTime","value":"', {!batchJobRuntimeParameters}) + LEN('{"name":"startTime","value":"'), 50 ) ) - 1 )extractedEndTime TEXT LEFT( MID( {!batchJobRuntimeParameters}, FIND('{"name":"endTime","value":"', {!batchJobRuntimeParameters}) + LEN('{"name":"endTime","value":"'), 50 ), FIND( '"', MID( {!batchJobRuntimeParameters}, FIND('{"name":"endTime","value":"', {!batchJobRuntimeParameters}) + LEN('{"name":"endTime","value":"'), 50 ) ) - 1 )startTimeAsDateTime Date/Time DATETIMEVALUE(SUBSTITUTE(SUBSTITUTE({!extractedStartTime}, "T", " "), "Z", ""))endTimeAsDateTime Date/Time DATETIMEVALUE(SUBSTITUTE(SUBSTITUTE({!extractedEndTime}, "T", " "), "Z", "")) -
Create an Action element to trigger the Process Provider Affiliation Addresses Batch job.
This element uses the startTimeAsDateTime and endTimeAsDateTime formulas.
- Select the Category as Batch Job, and then select the Process Provider Affiliation Addresses batch job.
-
For Label, enter Trigger Process Provider Affiliation Address Batch
Job.
The API name is automatically populated.
- In the Set input values section, select startTime as startTimeAsDateTime and endTime as endTimeAsDateTime.
- Click Done.
- Save and activate the flow.
Did this article solve your issue?
Let us know so we can improve!

