Skip to main content

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. 

Note: 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 flow variables 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. Select Screen Flow.
  4. Click Create.
  5. Click Toggle Toolbox to show the toolbox, then click New Resource.
  6. Select Variable from the Resource Type dropdown menu and enter the following.
    1. API Name: contactId
    2. Data Type: Text
  7. Save your work.

Repeat these steps to create other variables with the following properties. Save your work after creating each one.

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.
    1. Flow Label: Privacy Settings
    2. Flow API Name: Privacy_Settings
  3. Click Show Advanced.
  4. Select the following settings.
    1. How to Run the Flow: System Context Without Sharing - Access All Data
    2. Type: Screen Flow (this should already be selected)
  5. 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

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities