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

Create a Flow for Engagement Activities

Add Elements to the Flow

Linda must now create an accrual flow for engagement activities. Here’s a breakdown of the flow. The flow fetches transaction journals and checks for journal subtypes. Points are defined for the different activities. The flow checks the rules and credits points (qualifying and non-qualifying) to the members. 

A diagrammatic representation of how the flow checks the rules and credits points: Get transaction information from journal, Define the rules, Credit qualifying and non-qualifying points.

Note

Note

This flow has been partially created for you. In this step, we will add the remaining elements to complete the flow.

Linda selects the flow for engagement activities so she can modify it. 

  1. Click Setup, and select Setup.
  2. Enter Flows in the Quick Find box, and select Flows.
  3. Find and select the InnerCircleAccrualForEngagementActivities flow.

To this flow, Linda adds the Credit Points loyalty action. 

  1. On the Elements tab, drag the Action element onto the canvas and provide the following details.
    • Filter by: Loyalty
    • Action: Credit Points
    • Label: CreditNonQualifyingPoints
    • Program: Cloud Kicks Inner Circle
    • Currency Type: Regular Points
    • Recipient Member ID: Transaction Journal from GetTransactionJournals > MemberId
    • Number of Points to Credit: PointsToCredit
    • Journal ID: Transaction Journal from GetTransactionJournals > Id
  1. Click Done.
  2. Repeat steps 1 and 2 with the following values.
    • Filter by: Loyalty
    • Action: Credit Points
    • Label: CreditQualifyingPoints
    • Program: Cloud Kicks Inner Circle
    • Recipient Member ID: Transaction Journal from GetTransactionJournals > MemberId
    • Currency Type: Tier Points
    • Number of Points to Credit: 10
    • Journal ID: Transaction Journal from GetTransactionJournals > Id

The New Action window where you enter values required to credit points.

Linda must now connect all the elements using connectors to build the flow. This determines the order in which the flow is executed at run time.

  1. Connect the elements in the following sequence.
    • The Start element to GetTransactionJournals (Get Records)
    • GetTransactionJournals (Get Records) to CheckJournalSubType (Decision)
    • CheckJournalSubType (Decision) to the three Assignment elements AssignmentForAppDownload, AssignmentForCustomerSurvey, and AssignmentForSocialMediaActivity, with outcome selections being App Download, Customer Survey, and Social Media Activity respectively
    • All three Assignment elements to CreditNonQualifyingPoints (Action)
    • CreditNonQualifyingPoints (Action) to CreditQualifyingPoints (Action)
  1. Click Save.
  2. Click Activate.

The Flow Builder page where you add the required elements and connect them.

This flow will check the engagement activity and credit qualifying and non-qualifying points. Since engagement-related transactions are loaded into the system every night, Linda needs to create a batch job to process them. 

Create Accrual Batch

Linda creates a batch job to process transaction journal records in the pending state. Batch management creates smaller batches of the pending transactions and passes them through the flow. She then schedules the batch jobs to run as part of one scheduled flow. Let’s look at how she sets this up. 

  1. Click Setup, and select Setup.
  2. Enter Batch in the Quick Find box, and select Batch Management.
  3. Click New and provide the following details.
    • Name: InnerCircleAccrualBatch
    • Process Type: Flow
    • Group: Loyalty
    • Execution Process: InnerCircleAccrualForEngagementActivities
    • Batch Size: 5
    • Retry Count: 2
    • Retry Interval: 1000
  1. Click Next and provide the following details.
    • Flow Input Variable: JournalId
    • Object: Transaction Journal
    • Select Records When: Customize the Logic
    • Custom Logic: 1 AND 2 AND 3 AND (4 OR 5 OR 6)
    • Field: Loyalty Program ID
    • Operator: Equals
    • Type: Value
    • Value: Cloud Kicks Inner Circle
    • Click Add Condition and provide the following details.

      Field

      Operator

      Type

      Value

      Status

      Equals

      Value

      Pending

      Journal Type ID

      Equals

      Value

      Accrual

      Journal SubType ID

      Equals

      Value

      Social Media Activity

      Journal SubType ID

      Equals

      Value

      Customer Survey

      Journal SubType ID

      Equals

      Value

      App Download

  1. Click Save.
  2. Click Activate.

The New batch job page where you add the conditions for the batch.

This batch job will filter transactions from the Transaction Journal object.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback