Skip to content

Send surveys with a Screen Flow

This guide provides a step-by-step walkthrough for sending surveys to contacts using a Salesforce Screen Flow. This specific flow is designed to send surveys to all campaign members within a Salesforce Campaign.

Watch how it looks

Use case flow

The full survey flow

full survey flow


Prerequisites

  • Apex Action: Ensure the Request NPS Ratings action is available in your org.
  • nps.today CampaignID: Have your specific Survey/Campaign ID ready.
  • Permissions: You must have Flow Builder and Object Manager access.

Creating the Flow Foundation

  1. Navigate: Go to Setup > Flows and click New Flow.
  2. Select Type: Choose Screen Flow.
  3. The Record ID Variable:
    • Click New Resource in the left sidebar.
    • Resource Type: Variable.
    • API Name: recordId (⚠️ Casing is critical: lowercase 'r', uppercase 'I').
    • Data Type: Text.
    • Availability: Check Available for input.
    • Purpose: This "catches" the Salesforce Campaign ID from the button.

Variable

Finding the Recipients

  1. Add 'Get Records': Click the (+) on the canvas.
  2. Label: Get Campaign Members.
  3. Object: Campaign Member.
  4. Condition Requirements:
    • CampaignId Equals recordId
    • ContactId Is Null False
  5. How Many Records: Select All records.
  6. Storage: Select Automatically store all fields.

Get records


The Confirmation Screen

  1. Add 'Screen' Element: Click (+) after the Get Records step.
  2. Label: Confirm Survey Send.
  3. Configure Footer:
    • In the right sidebar, expand Configure Footer.
    • Under Next or Finish Button, select Use a custom label.
    • Type: Send Surveys Now.
  4. Add 'Data Table' Component:
    • Drag Data Table from the left components menu onto the screen.
    • Source Collection: Select {!Get_Campaign_Members}.
    • Configure Columns: Add your preferred columns, e.g., Contact > Full Name and Contact > Email.

Confirmation Screen


The Sending Loop

  1. Add 'Loop': Click (+) after the Confirmation Screen.
  2. Label: Loop 1.
  3. Collection Variable: Select {!Get_Campaign_Members}.
  4. Add 'Action' (Inside the Loop): Click (+) on the "For Each Item" path.
  5. Search: Search for Request NPS Ratings.
  6. Set Input Values:
    • Campaign Id: Type your campaign ID (e.g., 18134).
    • Respondent Id: {!Loop_1.ContactId}.
    • Responsible: {!Loop_1.Campaign.OwnerId}.
    • What-Id: {!Loop_1.CampaignId}.

The Sending Loop


The Success Message

  1. Add 'Screen' Element: Click (+) on the path labeled After Last.
  2. Label: Success.
  3. Configure Footer:
    • Under Next or Finish Button, select Use a custom label.
    • Type: Done.
  4. Add 'Message' Component:
    • Drag the Message (or Success Message) component onto the screen.
    • Message Content: Success! All surveys have been sent.
    • Message Type: Select Success (this generates the green background).

The Success Message


Deployment (The Button)

  1. Object Manager: Go to Object Manager > Campaign > Buttons, Links, and Actions.
  2. New Action: Click New Action.
    • Action Type: Flow.
    • Flow: Select your new Flow.
    • Label: Send NPS Surveys.
      Button
  3. Update Page Layout:
    • Go to Campaign Page Layouts.
    • Click Mobile & Lightning Actions in the top palette.
    • Drag Send NPS Surveys into the Salesforce Mobile and Lightning Experience Actions section. Update Page Layout

Troubleshooting

  • Empty Table? Ensure the Campaign Members are added as Contacts and not Leads.
  • Action Missing? Ensure the nps.today package is properly licensed and that the Apex class is accessible to the user's profile.