Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.
Tempo stimato

Set Up Record Variables

Learning Objectives

In this project, you’ll use Flow Builder to build a self-registration flow that:

  • Allows customers to self-register to a portal.
  • Captures information from the customer.
  • Creates an individual record for the user to store communication preferences.
  • Updates the contact record with information from the individual record.

Introduction

This project walks you through creating a self-registration login flow. Login flows customize the login experience and integrate business processes with Salesforce authentication. In this example, we ask users to choose their data privacy settings. By the end of the project, you’ll have a fully functional flow, which you can use in the Self-Registration in a Portal module. Let’s get this party started!

Create a New Trailhead Playground

For this project, you need to create a new Trailhead Playground. Scroll to the bottom of this page, click the playground name, then click Create Playground. It typically takes 3–4 minutes to create a new Trailhead Playground. 

Yes, we really mean a brand-new Trailhead playground! If you use an existing org or playground, you can run into problems completing the challenges.

Overall Flow Design

Here’s what the final flow looks like in Flow Builder.

Final flow, with all elements.

There are five elements in the flow—here’s what each of them does.

  1. Gets the user’s information
  2. Asks customers for their data privacy settings
  3. Creates an individual record based on the privacy settings
  4. Updates the contact record (created in the self-registration steps for the portal) with the correct privacy settings
  5. Welcomes a new member to the portal

Before setting up the flow, however, we first have to set up record variables (watch the What is a Variable? video to learn more) that are used throughout the flow.

Set Up Record Variables

  1. In Setup, enter Flows in the Quick Find box, then select Flows.
  2. Click New Flow.
  3. Make sure Start from Scratch is selected, and click Next.
  4. Select Screen Flow.
  5. Click Create.
  6. Click Toggle Toolbox to show the toolbox, then click New Resource.
  7. Select Variable from the Resource Type dropdown menu and enter the following.
    • API Name: contactId
    • Data Type: Text
  1. Click Done.

Repeat these steps to create other variables with the following properties.

Record Type

Values

Variable

  • API Name: individualId
  • Data Type: Text

Variable

  • API Name: LoginFlow_UserId
  • Data Type: Text
  • Select Available for input

Variable

  • API Name: registrantsAccount
  • Data Type: Text

Variable

  • API Name: UserInfo
  • Data Type: Record
  • Object: User

The record variable stores updatable field values for a Salesforce record. Basically, the flow uses this variable to temporarily store the data as users go through the flow.

At this point, let’s save our work, because nothing is worse than failing to save something you’ve worked on (especially a flow). 

  1. Click Save.
  2. Name the flow.
    • Flow Label: Privacy Settings
    • Flow API Name: Privacy_Settings
  1. Click Show Advanced.
  2. Select the following settings.
    • How to Run the Flow: System Context Without Sharing - Access All Data
    • Type: Screen Flow (this should already be selected)
  1. Click Save. If you get a warning, cancel out of it.

Now that you’ve set up your variables, you’re ready to start creating the flow.

Resources

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback