Loading

Salesforce Platform Flow: Update Campaign Member Status Based on Lead Status

Udgivelsesdato: Sep 22, 2026
Beskrivelse

Business Use Case:

For example, If the Lead status is equal to Working – Contacted or MQL and the Campaign Member status is equal to Filled out form, we then need to update the campaign member status to Qualified.

Here we are going to see how can we update the status field on campaign members if certain criteria are met on the related lead record.

Løsning

This article explains how to build two Record-Triggered Flows that update Campaign Member status to Qualified based on the related Lead's status: one flow on the Campaign Member object and one on the Lead object.

To build out this automation, we would need to create two Record-Triggered flows, one on the campaign member and the other on the lead. Let's take a look at each of those flows one by one.

Campaign Member Flow

We need to create a Record-Triggered before saving flow (On Update) on the Campaign Member object which would check the triggering Campaign Member status and verify whether the related lead record meets the conditions. If all the conditions are satisfied, we would update the triggering record status to Qualified.

Step 1: Create a Record-Triggered before saving flow on the Campaign Member object

  1. From Setup, in the Quick Find box, enter Flows, and then select Flows
  2. Click on New Flow, select Record-Triggered flow and hit on Create button
  3. In Object field, enter and select Campaign Member
  4. For Trigger the Flow When, choose A record is updated
  5. In Condition Requirements, choose All Conditions Are Met (AND)
  6. Add the following details as your entry conditions
    1. Field Status, operator Is Changed, value TRUE
    2. Field Status, operator Equals, value Filled out form
    3. Field LeadId, operator Is Null, value FALSE
  7. In When to Run the Flow for Updated Records, choose Every time a record is updated and meets the condition requirements
  8. In Optimize the Flow for, choose Fast Field Updates

Configure Start element for the Campaign Member Record-Triggered Flow with A record is updated selected

Entry conditions configured for the Campaign Member flow checking Status and LeadId

Step 2: Add a Get Records element on the Lead object

  1. Drag Get Records element on canvas. Give it a Name, and API Name will be filled in automatically.
  2. In Get Records of This Object choose Lead
  3. In Conditions Requirements select All Conditions Are Met (AND). Add a filter condition as ID, operator is Equals and value is $Record.LeadID
  4. In How Many Records to Store, choose Only the first record
  5. In How to Store Records Data, select choose fields and let Salesforce do the rest.
  6. In Select Lead Fields to Store in Variable, enter and select Lead ID, choose Status for the second field

Get Records element configured to retrieve the related Lead record

Get Records filter condition matching Lead ID to the triggering record's LeadID

Step 3: Add a Decision element to check whether the Lead record matches the status or not

  1. Drag Decision element on canvas. Give it a Name, and API Name will be filled in automatically.
  2. In Outcomes section, add two outcomes as Lead_Status_Matched and Lead_Status_Do_Not_Matched
  3. For Lead_Status_Matched
    1. Type the Label (Lead_Status_Matched). API name will be auto generated
    2. In Condition Requirements to Execute Outcome select Any Conditions is Meet (OR)
    3. Click on Resource and enter and select {Lead from Get_Related_Lead_Records > Status}, operator Equals, and value Working - Contacted
    4. Click on Add Condition
    5. Select Resource as {Lead from Get_Related_Lead_Records > Status}, operator Equals, and value MQL
  4. Under Outcome Order. Click on Default Outcome. Change the label to Lead_Status_Not_Matched

Decision element configured with Lead_Status_Matched and Lead_Status_Not_Matched outcomes

Step 4: Add Update Records element and connect it with the Decision element (Lead Status Matched)

  1. Drag Update Records element on canvas. Give it a Name, and API Name will be filled in automatically.
  2. In How to Find Records to Update and Set Their Values, choose Use the campaign member record that triggered the flow
  3. In Set Filter Condition, select None - Always Update Record
  4. In Set Field Values for the Campaign Member Record, enter and select Status, and your value is Qualified. Click Done button

Update Records element setting Campaign Member Status to Qualified

Here is how the first flow will look like

Completed Campaign Member flow canvas showing Start, Get Records, Decision, and Update Records elements

Lead Flow

We need to create an after-save flow (On Update) on the Lead object, which would first check the conditions on the triggering lead record and, if satisfied, update all the related campaign member records (where Status is filled out Form)

Step 1: Create a Record-Triggered flow on Lead object and choose to run when A Record is Updated

  1. From Setup, in the Quick Find box, enter Flows, and then select Flows
  2. Click on New Flow, select Record-Triggered flow and hit on Create button
  3. In Object field, enter and select Lead
  4. For Trigger the Flow When, choose A record is updated
  5. In Condition Requirements, choose Custom Condition Logic Is Met
  6. In Condition Logic, enter 1 (2 AND 3)
  7. Add the following conditions
    1. Status, Operator is Is Changed, value TRUE
    2. Status, Operator is Equals, value Working – Contacted
    3. Status, Operator is Equals, value MQL
  8. In When to Run the Flow for Update Records, choose Every time a record is updated and meets the condition requirements
  9. In Optimize the flow for, select Actions and Relation Record. Click on Done button

Configure Start element for the Lead Record-Triggered Flow with A record is updated selected

Entry conditions configured for the Lead flow checking Status against Working-Contacted and MQL

When to Run the Flow for Updated Records setting on the Lead flow

Step 2: Add an Update Records Element and choose the option to update records related to the lead record that triggered the flow

  1. Drag Update Records element on canvas. Give it a Name, and API Name will be filled in automatically
  2. In How to Find Records to Update and Set Their Values, choose Update records related to the lead record that triggered the flow
  3. Under Records Related to Lead, set the value to {!$Record.CampaignMembers}
  4. In Condition Requirements to Update Record, choose None-Update All Related Records
  5. Under Set Field Values for the Campaign Member Records, choose Status and value is Qualified. Click on Done button

Update Records element updating related Campaign Member records from the Lead flow

Set Field Values screen for the Campaign Member records setting Status to Qualified

Here is how the second flow looks like

Completed Lead flow canvas showing Start and Update Records elements

_____________________________________________________________________________________

Written by: Sumeet Negi | Salesforce Answers Leader

Sumeet Negi is a Salesforce Developer at Eptura and one of the top Answers Leader in the Trailblazer Community. He is 4x Salesforce certified and has more than 3.5 years of experience on the Salesforce platform. He is passionate about helping trailblazers get the most out of Trailblazer Community.

Submissions reflect only the opinions of the user who made available the Submission and not the opinions of Salesforce, regardless of whether the user is affiliated with Salesforce, and may contain or constitute products, services, information, data, content and other materials made available by or on behalf of third parties ("Third Party Materials). Salesforce neither controls nor endorses, nor is Salesforce responsible for, any Third Party Materials, including their accuracy, validity, timeliness, completeness, reliability, integrity, quality, legality, usefulness or safety, or any applicable intellectual property rights. Any Submissions made available through any message board or forum in response to posted questions, or that otherwise purports to answer any questions, including any questions about Salesforce or Programs, are made available for your general knowledge only and should never be relied upon as answers to your specific questions (even if an answer is marked as a "best" answer or with any similar qualifications). You should always contact Salesforce support for answers to your specific questions. Salesforce has no control over Submissions, and is not responsible for any use or misuse (including any distribution) by any third party of Submissions.

If you have questions, tap into the wisdom of our entire Trailblazer Community here: https://trailhead.salesforce.com/trailblazer-community/feed

Vidensartikelnummer

000394583

 
Indlæser
Salesforce Help | Article