---
schema_version: "1"
id: ae9735e69a1098fe8349477d127696ff3dfa894bb4aa4dde0620c079a7a780d5
title: Create Multiple Records with a Repeater Screen Component Example
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/automate_flow_build_example_screen_comp_repeater.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.automate_flow_build_example_screen_comp_repeater.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: dc13a7f59de9e096a7993a0d305f92b3073d52b52fd99110636368f608aa3a14
description: This example creates screen flows that use Repeater components to collect information for multiple related items and perform bulk actions on that data. Use Repeater components when you need to gather the same type of information for multiple records, such as collecting product information for multiple items. The flow can then automatically create and link related records based on the collected information.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# Create Multiple Records with a Repeater Screen Component Example

This example creates screen flows that use Repeater components to collect information for multiple related items and perform bulk actions on that data. Use Repeater components when you need to gather the same type of information for multiple records, such as collecting product information for multiple items. The flow can then automatically create and link related records based on the collected information.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=platform.flow_ref_supported_editions.htm&amp;release=264.0.0&amp;type=5" title="Learn about the editions and user interfaces that support Flow Builder. Some Flow Builder features integrate with other Salesforce products that require additional licenses.">View supported editions.</a></td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:left;vertical-align:top;" id="d49852e61">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d49852e61 ">To open, edit, create, activate or
              deactivate a flow using all flow types, elements, and features available in Flow
              Builder, including Einstein and Agentforce for Flow:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d49852e61 ">Manage Flow</td>

          </tr>
        </tbody>
      </table>

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/images/icon_note.png)

Note You don't need to be an admin to have the Manage Flow permission. Ask your admin to add it to your profile or permission set.

This example configures a screen that collects a first name, last name, and email address for each person that's added. The user can add as many family members as needed. After the information is collected, the flow automatically creates a customer account and a contact record for each person entered, all connected to that same account.

## Create a Screen Flow

Create a screen flow to collect information from your customers.

1. Open the Flows list view.
    
    - From the Automation app, select the **Flows** tab.
    - From the **Flows** tab in any Lightning app, click the actions menu and select **Open Flow**.
    - From Setup, in the Quick Find box, enter Flows, and then select **Flows**.
    
    Note that the Automation app and Flows tab options don't require Setup access.
2. Create a screen flow.
    
    - From the Automation app, click **New** | **Screen Automations** | **Screen Flow**.
    - From Setup, click **New Flow** | **Screen Automations** | **Screen Flow**
    
    The new screen flow opens in Flow Builder.

## Add and Configure a Screen Element

Add a screen element that contains instructions and a Text component to collect a family name. The family name is used as the account name when we create the account. Then add a Repeater component to show a set of contact fields multiple times on the screen. Because we're collecting first names, last names, and email addresses, add a Name component and an Email component within the Repeater component.

1. Add a Screen element.
    1. Click ![Add element plus icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_add_element_plus.png), and select **Screen**.
    2. For Label, enter Collect Customer Information.
        
        The API name autofills.
2. Add instructions and a Text component to hold the family's name.
    1. Add a Display Text component. From the Components list, in the Display section, click **Display Text**. For API Name enter DisplayInstructions. For the text box, enter Enter a name for your family. Then enter your information and the information for any additional family members you want to add to our list.
    2. Add a Text component. From the Components list, click **Text**. For Label, enter Family Name. The API name autofills.
3. Add a Repeater component and child screen components to go in the Repeater component.
    1. In the Components List, in the Display section, click **Repeater**.
    2. For API Name, enter RepeatCustomerFields.
    3. Add a Name component. From the Components list, drag and drop a **Name** component into the Repeater component. For API Name enter CustomerName
    4. Style the Name component. Click the **Style** tab. For Width, select **6 of 12 (Half Width)**.
    5. Add an Email component. From the Components list, drag and drop an **Email** component into the Repeater component. For API Name enter CustomerEmail
    6. Style the Email component. Click the **Style** tab. For Width, select **6 of 12 (Half Width)**.
    7. Move the Email component to other half of the Repeater component.
4. Add a default value for the Family Name component to give users an example of what information to enter. The default value is shown in the screen component until the user enters a value.
    1. Click on the **Family Name** component.
    2. For Default Value, click the **Family\_Name** screen component, and then enter Family. The full default value is {!Family\_Name} Family.
5. Click **Done**.
    
    ![A Repeater component on a screen element](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_build_example_screen_cmp_repeater_panel.png)

## Add and Configure a Create Records Element for the Account

Add and configure a Create Records element to create the account record that's related to the new contacts.

1. Click ![Add element plus icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_add_element_plus.png), and select **Create Records**.
2. For Label, enter Create Account.
    
    The API name autofills.
3. For How to set record field values, select **Manually**.
4. For Object, select **Account**.
5. For the Account Name value, select the **Collect Customer Information** screen, and then select **Family Name**.
    
    This step selects the family name that the user entered as the name of the new account.

## Add and Configure a Loop Element

Add and configure a Loop element to process the information gathered from the screen element, one family member at a time.

1. Click ![Add element plus icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_add_element_plus.png), and select **Loop**.
2. For Label, enter Iterate Over Customers.
    
    The API name autofills.
3. For Collection Variable, click the **Collect Customer Information** screen, then the **RepeatCustomerFields** screen component, and then the **AllItems** output.
    
    This step selects the information entered into the Repeater component as the items to loop through.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/images/icon_note.png)

Note This flow uses variables and Assignment elements inside a loop to process the new contact information, rather than a Create Records element. This approach keeps the data processing within the flow until all information is gathered, and then a single Create Records element is used outside the loop to create all contact records as a group. This approach minimizes database interactions and prevents potential errors. For example, think about collecting customer emails at an event by using paper. You could process each customer one at a time: Get their email, go back to your computer, add them to the email list, and then go back to get the next email. But that takes a lot of effort! Or, you could gather everyone's emails first, and then add them all to the email list in one batch later. The second way is much faster.

## Add and Configure a Contact Record Variable

Add and configure a Record Variable resource to hold contact record field values. The Repeater component doesn't know what kind of information it's collecting, so map the Repeater output to a placeholder contact record for each family member that we loop through.

1. Click ![Open toolbox](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/automate_flow_build_open_toolbox.png) and then click **New Resource**.
2. For Resource Type, select **Variable**.
3. For API Name, enter ContactRecord.
4. For Data Type, select **Record**.
5. For Object, select **Contact**.
6. Click **Done**.

## Add and Configure a Contact Record Collection

Because we're creating multiple contacts at one time, we need a Record Collection Variable resource to hold the information about all the contacts as a group.

1. Click ![Open toolbox](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/automate_flow_build_open_toolbox.png) and then click **New Resource**.
2. For Resource Type, select **Variable**.
3. For API Name, enter ContactCollection.
4. For Data Type, select **Record**.
5. For Object, select **Contact**.
6. Select **Allow multiple values (collection)**.
    
    This step makes the variable a collection variable that can hold multiple items, like records.
7. Click **Done**.
    
    ![Contact record collection variable](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_contact_collection_variable.png)

## Add and Configure an Assignment Element to Set Contact Record Values

Add and configure an Assignment element in the loop path to set contact field values for each family member in the loop.

1. After For Each, click ![Add element plus icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_add_element_plus.png), and select **Assignment**.
2. For Label, enter Set Contact Record Values.
    
    The API name autofills.
3. For Variable, click the **ContactRecord** record variable and then click the **Account ID** field.
4. For Operator, select **Equals**.
5. For Value, select **AccountId from Create Account**.
    
    This step sets the contact's account to the one that we created.
6. Click **Add Assignment**.
7. For Variable, select **ContactRecord**, and then select **First Name**.
8. For Operator, select **Equals**.
9. For Value, click **Current Item from Loop**, click the **CustomerName** screen component, and then click the **First Name** output.
    
    This step sets the contact's first name to the first name the customer enters in the screen.
10. Repeat steps 6 through 9 for the customer's last name and email. When selecting the value for the email, click **Current Item from Loop** | **CustomerEmail** | **Value** | **.**
    
    ![Set Contact Record Values Assignment element with the field values set](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_screencmp_repeater_example_assignment.png)

## Add and Configure an Assignment Element to Add the Contact to the Collection

Add and configure another Assignment element in the Loop path to store the contact field values for each family member in the contact record collection variable. After the contact record values are saved, the contact record variable can be used to store the next family member's information.

1. After the Set Contact Record Values Assignment element, click ![Add element plus icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_add_element_plus.png), and select **Assignment**.
2. For Label, enter Add Contact to Collection.
    
    The API name autofills.
3. For Variable, click the **ContactCollection** record collection variable.
4. For Operator, select **Add**.
5. For Value, select the **ContactRecord** record variable that we just populated the fields for.
    
    This step adds the contact that's in the loop to the contact record collection. Now that those field values are saved in ContactCollection, the ContactRecord record variable is ready to be reused for the next contact's information.

## Add and Configure a Create Records Element to Create the Contacts

Add and configure a Create Records element to create all of the contacts at once. Because we stored all of the contacts in the record collection variable, we can ask the Create Records element to create records for everything in that collection.

1. After the Loop and Assignment elements, outside of the loop, click ![Add element plus icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_add_element_plus.png), and select **Create Records**.
2. For Label, enter Create Contacts.
    
    The API name autofills.
3. For How to set record field values, select **From a Record Variable**.
4. For How Many Records to Create, select **Multiple**.
5. In the Select Values to Create Multiple Records section, for Record Collection, select **ContactCollection**.
6. Save your flow and give it a descriptive name. For this example, Create an Account and Contact Records for a Family using an Online Form.
7. Test your flow by using sample data and different scenarios.
8. When you're ready to activate your flow, click **Activate**.

![Full flow with all the elements](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_example_screencmp_repeater_full_flow.png)

The flow is ready to collect information about multiple customers and create an account and multiple related contacts with that information.