Skip to main content
Free Agentforce workshops and AI Certifications: Learn more. Terms and conditions apply.

Run the Accrual Process

Configure the Batch Job

Linda must now schedule the batch job to run to complete the accrual process. She does this by creating a scheduled flow. 

  1. Click Setup, and select Setup.
  2. Enter Flows in the Quick Find box, and select Flows.
  3. Click New Flow.
  4. Make sure Start From Scratch is selected, then click Next.
  5. Select Scheduled-Triggered Flow, then click Create.
  6. In the button bar, change the Auto-Layout setting to Free-Form.
  7. On the Manager tab, click New Resource and provide the following details.
    • Resource Type: Variable
    • API Name: Output_Event
    • Data Type: Record
    • Object: Batch Job Status Changed Event
  1. Click Done.

The New Resource window where you create the variable for the batch job status.

Linda adds the elements to run the batch job.

  1. On the Elements tab, drag the Action element onto the canvas, and provide the following details.
    • Filter by: Batch Job
    • Action: InnerCircleAccrualBatch
    • Label: Accrual Batch
  1. Click Done.

The New Action window where you enter a label for the batch job.

Next, Linda adds a Wait for Conditions element. This will pause the flow until the batch processing is complete. 

  1. Drag the Wait for Conditions element onto the canvas and provide the following details.
    • Label: Pause For Accrual Batch
    • In the Wait Configuration Details section, enter the Label: Accruals Processed
    • Under Wait Conditions, for When to Wait, select Always Wait-No Conditions.
  1. Click Resume Event and provide the following details.
    • Wait Until: A Platform Event Message is Received
    • Platform Event: Batch Job Status Changed Event
    • Condition Requirements: All Conditions Are Met (AND)
    • Field: Batch Job
    • Value: Outputs from Accrual_Batch > batchJobId
    • Platform Event Message: Output_Event
  1. Click Done.

The New Wait for Conditions window where you enter details of the pause communication.

Linda adds the Decision element to check if the batch job status is successful. 

  1. Drag the Decision element onto the canvas and provide the following details.
    • Label: Check Success
    • Outcome Details Label: Success
    • Condition Requirements to Execute Outcome: All Conditions are Met (AND)
    • Resource: Output_Event > Status
    • Operator: Equals
    • Value: Success
  1. Click Done.

The New Decision window where you define the outcome details.

Linda has to set the schedule for the flow. Since transactions related to engagement activities are loaded into Loyalty Management every night, Linda sets up the flow to run on a daily basis. 

  1. On the Start element, click Set Schedule and specify the following details.
    • Start Date: Current date
    • Start Time: 12:00 AM
    • Frequency: Daily
  1. Click Done.

The Set a Schedule window where you define the schedule.

Linda connects all the elements using connectors to build the flow. 

  1. Connect the elements in the following sequence.
    • The Start element to Accrual Batch (Action)
    • Accrual Batch (Action) to Pause For Accrual Batch (Wait for Conditions)
    • Pause For Accrual Batch (Wait for Conditions) to Check Success (Decision), with the outcome selection being Accruals Processed
  1. Click Save.
  2. Enter the Flow Label: AccrualOrchestration
  3. Click Save.
  4. Click Activate.

The Flow Builder page where you connect the elements for the accrual orchestration.

Run the Accrual Process

Let’s look at how the points are credited when a transaction is made. 

Create a Transaction Journal

Adria Darby is very happy with the shoe she purchased and has mentioned Cloud Kicks in her recent social media post. When the orchestration flow runs, she is credited with 50 non-qualifying points and 10 qualifying points. 

Similar to how she created a transaction journal in Step 2, Linda creates another for Adria Darby with the following details.

  1. In the Loyalty Programs tab, select the Cloud Kicks Inner Circle loyalty program.
  2. In the Cloud Kicks Inner Circle program record, click the Members And Partners tab.
  3. In the Loyalty Program Members related list, select CL001.
  4. On the Transaction Journals card, click New.
  5. Provide the following details.
    • Journal Type: Accrual
    • Journal Subtype: Social Media Activity
    • Activity Date: Current Date
    • Journal Date: Current Date
    • Status: Pending
    • Loyalty Program: Cloud Kicks Inner Circle
  1. Click Save.

The New Transaction Journal window where you can manually create a transaction journal.

Run the Flow

Linda runs the flow and checks the points balance update. 

  1. Click Setup, and select Setup.
  2. Enter Flows in the Quick Find box, and select Flows.
  3. From the Flows list view, select AccrualOrchestration.
  4. Click Debug.
  5. Disable Debug pause element behavior.
  6. Click Run.

This triggers the Inner Circle Accrual Batch job. Linda can monitor the status of the run by navigating to Monitor Workflow Services. 

Note

Note

To learn more about Workflow Services, review the Monitor Your Data Processing Engine Definition Runs help documentation. 

After the status of the runs change to Completed, Linda navigates back to the member record page where she sees the updated qualifying and non-qualifying points balance. Note that you may need to refresh the page to see the updated points balance. 

In Conclusion

Using a combination of batch management, DPE, and flows, Linda has successfully set up the accrual process. The Loyalty Management platform gives you the flexibility to customize the accrual process according to your business needs. You can add more complexity to the accrual rules and make use of decision tables. And accruals are not limited to points alone. You can set up the process to reward members with vouchers and experiences as well. 

Resources

Compartilhe seu feedback do Trailhead usando a Ajuda do Salesforce.

Queremos saber sobre sua experiência com o Trailhead. Agora você pode acessar o novo formulário de feedback, a qualquer momento, no site Ajuda do Salesforce.

Saiba mais Continue compartilhando feedback