Loading
Salesforce now sends email only from verified domains. Read More
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Sequence Address Batch Jobs by Using a Flow

          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
          1. From Setup, enter Flows in the Quick Find box, select Flows, and then select New Flow.
          2. In the New Flow window, select Platform Event - Triggered Flow.
          3. For Platform event, select Batch Job Status Changed Event and in Advanced settings, select Run this flow as the user that triggered the event.
          4. Create a decision element that uses a record or answers from a screen input to determine a flow path.
            1. On the flow canvas, add a Decision element.
            2. Enter a label and API name for the element, for example Is HCP Contact Point Addresses Batch Job Complete?
            3. 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
            4. Click Done.
          5. Create variables that store the batch job runtime parameters and make the value available for output.
            1. From the toolbox, select Manager and then select New Resource.
            2. For Resource Type, select Variable.
            3. For API Name, enter batchJobRuntimeParameters.
            4. For Data Type, select Text.
            5. Select Available for output.
            6. Click Done.
          6. Create a Get Records element to retrieve the HCP Contact Point Addresses batch job details.
            1. On the flow canvas, add a Get Records element.
            2. Enter a label and API name for the element, for example Get Batch Job Record.
            3. For Object, select Batch Job.
            4. Under Filter Account Records Condition Requirements, select All Conditions are Met (AND).
            5. For Field, enter Id, then select Run ID.
            6. For Operator, select Equals.
            7. For Value, select Resource Triggering BatchJobStatusChangedEvent -> Batch Job.
            8. For How Many Records to Store, select Only the first record.
            9. For How to Store Record Data, select Choose fields and assign variables (advanced).
            10. For Where to Store Field Values, select In separate variables.
            11. For Field, select Runtime Parameter.
            12. For Value, select batchJobRuntimeParameters.
            13. Click Done.
          7. 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", ""))
          8. Create an Action element to trigger the Process Provider Affiliation Addresses Batch job. This element uses the startTimeAsDateTime and endTimeAsDateTime formulas.
            1. Select the Category as Batch Job, and then select the Process Provider Affiliation Addresses batch job.
            2. For Label, enter Trigger Process Provider Affiliation Address Batch Job.
              The API name is automatically populated.
            3. In the Set input values section, select startTime as startTimeAsDateTime and endTime as endTimeAsDateTime.
            4. Click Done.
          9. Save and activate the flow.
           
          Loading
          Salesforce Help | Article