Skip to main content

Use Custom Metadata Types in Flows

Learning Objectives

After completing this unit, you’ll be able to:
  • Explain how to reference a custom metadata type record in a flow.
  • Use Flow Builder to reference a custom metadata type and include its record information in flow.


Good progress so far! Let’s keep the momentum going, because we can do even more with custom metadata types. 

Before we continue, though, make sure that you’ve checked out how to use Salesforce Flow tools in Trailhead. We’re going to reference a custom metadata type record in a flow. Still learning the ins and outs of using Flow Builder? Our example here is super simple, so don’t fear. When you see how you can use custom metadata types in Flow Builder, you’ll want to build your own flow.

You probably already know that Flow Builder is a tool that you can use to automate business processes. Acme Services is a large, multinational service company, so creating repeatable business flows is crucial to functioning efficiently.

Acme Services wants to automatically update the support tier associated with an account when the account reaches a required spending threshold. Because Acme Services imports a lot of data from external systems, they need to automate this process using flows that run on a schedule.

Create a Flow That References a Custom Metadata Type Record

In the Create and Manage Custom Metadata Types unit, you created a custom metadata type called Support Tier. This unit references that custom metadata type and record for a flow.

Let’s create our flow:

  1. From Setup, enter Flows in the Quick Find box, then select Flows.
  2. Click New Flow, select Screen Flow, and click Create.
  3. Click Add node, and then select Get Records.
  4. For the label, enter Get Support Tier Config.
    We need to reference the Support Tier records to help us update accounts where minimum spending has reached Gold status.
  5. The API Name is automatically set to Get_Support_Tier_Config.
  6. For Object, select Support Tier.
  7. For Filter Support Tier Records, select All Conditions Are Met (AND) and enter these values.
    Field Operator Value
    MasterLabel Equals Gold 
  8. Set the Sort Order to Ascending and Sort By to DeveloperName.
  9. Click Done. You’ve successfully identified the Support Tier object, filtered the object’s records, and set the sort for the filtered records. Next, you’ll update those records.

Update the Account Records

In an Update Records element, you identify which records to update and how you want to update those records. Based on the configuration records that we got, we want to update some accounts.

  1. Click Add node below the Get Records element, and then select Update Records.
  2. For Label, enter Update Gold Accounts.
  3. The API Name is automatically set to Update_Gold_Accounts.
  4. Click Specify conditions to identify records, and set fields individually.
  5. For Object, select Account.
  6. For Filter Account Records, select All Conditions Are Met (AND) and enter these values.
    Field Operator Value
    Total_Spending__c Greater Than or Equal {!Get_Support_Tier_Config.Minimum_Spending__c}
  7. In the Set Field Values for the Account Records section, add the field values.
    Field Value
    Support_Tier__c Gold
  8. Click Done.

Connect the Flow

Save and activate the flow.

  1. Click Save.
  2. Enter a Flow Label and Flow API Name.
  3. Click Save.
  4. Click Activate.
    Any previously activated version (if one exists) is deactivated.

Check the Flow

We want to make sure that the flow will update the records, so before running the flow, let's confirm the current Support Tier value and change the opportunity amount.   

  1. From the App Launcher (The App Launcher icon.), select Sales and click on the Accounts tab.
  2. Open the Beebs Publishing account and click the Details tab.
  3. Confirm that the Support Tier is Bronze.
  4. Click the Related tab
  5. From Beebs Publishing Q1 opportunity, select Edit.
  6. Change Amount to 5,500 and click Save.
  7. Go back to the Flow Builder window and click Run.
  8. Open the Beebs Publishing account and refresh the page.
    The Support Tier should now be Gold.

The account records with a minimum value that meets or exceeds the minimum in the Gold Support Tier record are updated to the Gold tier. And that’s it. You just created a flow that references custom metadata type records.

Let’s recap what we’ve done in this module, which is a lot given that we didn’t need to code anything.
  1. We created a custom metadata type and added records to it.
  2. We referenced a custom metadata type record in a formula and also in a default value.
  3. We created a validation rule based on a custom metadata type record.
  4. We used records from a custom metadata type in a flow.

If you continue to the next module, and we hope you do, you can learn about some of the more technical aspects of working with custom metadata types.


Keep learning for
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