---
schema_version: "1"
id: b341288e89ab17644e7fec8c0507727fe8afd06b98b709f84c955e7b8a01149c
title: Add Records from User Input in Screens Using Repeaters Example
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/flow_elements_screen_modify_records.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.flow_elements_screen_modify_records.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 234967626966eaab7ebb8a17e27d91ae17d63966bc601cde77a52bd8c6a70bac
description: This example uses a screen flow with the Repeater component to gather information from users at run time. You can collect data for multiple items in a group. The Repeater component has one or more child components. The values in these components can be prepopulated on the screen at run time. Users can update, delete, and add values for the group. The changes from the user interaction can be also be committed to Salesforce records.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# Add Records from User Input in Screens Using Repeaters Example

This example uses a screen flow with the Repeater component to gather information from users at run time. You can collect data for multiple items in a group. The Repeater component has one or more child components. The values in these components can be prepopulated on the screen at run time. Users can update, delete, and add values for the group. The changes from the user interaction can be also be committed to Salesforce records.

When the Repeater component uses a record collection data source, each item generates a repeater instance at run time. The displayed values depend on how you map them into the Repeater's child components. At run time, users can add up to 30 instances of the Repeater component to the screen.

For example, assume you have information about a few insurance policy beneficiaries, but the list isn't complete. You want the user to add the remaining beneficiaries and include details such as the beneficiary's name, address, and email address. You then want to store those details in the Salesforce database. At run time, prepopulate the beneficiary information that you already have. Users can add details for beneficiaries not listed. The flow then creates Salesforce beneficiary records for the beneficiaries that the user has added.

![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 example uses the Create Records element to create beneficiary records for all beneficiaries the user adds on the screen.

## Create a Beneficiary Custom Object

1. In Setup, select **Object Manager**.
2. Click **Create** and then select **Custom Object**.
3. On the New Custom Object page, specify these details:
    1. For the Label field, enter Beneficiary. The Object Name, Record Name, and Data Type fields populate automatically.
    2. For the Plural Label field, enter Beneficiaries.
4. Click **Save**.
5. From the object management settings for beneficiary, go to Fields and Relationships.
6. Click **New**.
7. On the Choose the field type page, under Data Type, select **email**, and click **Next**.
8. On the Enter the details page, for Field Label, enter Email Address, and click **Next**.
9. On the Establish field-level security page, accept the defaults, and click **Next**.
10. On the Add to page layouts page, accept the defaults and click **Save & New**.
11. On the Choose the field type page, select **Text Area (Long)**, and click **Next**.
12. On the Enter the details page, for Field Label, enter Address, and click **Next**.
13. On the Establish field-level security page, accept the defaults, and click **Next**.
14. On the Add to page layouts page, accept the defaults, and click **Save**.

## Create a Custom Tab for the Beneficiary Object

1. From Setup, in the Quick Find box, enter Tabs and select it.
2. To create a custom tab for the Beneficiary object, under Custom Object Tabs, click **New**.
3. On the Enter the Details page, specify these details:
    1. Under Object, select **Beneficiary**.
    2. Under Tab Style, select **People**.
    3. Click **Next**.
4. On the Add to Profiles page, accept the defaults, and click **Next**.
5. On the Add to Custom Apps page, accept the defaults, and click **Save**.
6. Refresh the webpage.

## Create Beneficiary Records

1. From the App Launcher, find and select **Beneficiaries**.
2. To create a beneficiary from the Beneficiaries related list, click **New**.
3. Add one or more beneficiaries.
4. For every beneficiary, enter details such as their name, address, and email address.

## Create a Screen Flow

Create a screen flow to collect beneficiary information from your users.

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.
    1. From the Automation app, click **New** | **Screen** | **Screen Flow**.
    2. From Setup, click **New Flow** | **Screen** | **Screen Flow**

## Add and Configure a Get Records Element

1. To add an element, click ![The plus sign icon to add an 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_builder_add_element_plus.png) and search for and select **Get Records**.
2. For the Get Records element, specify this information:
    1. For the label field, enter Get Beneficiary Information.
    2. Under Object, search for and select **Beneficiary**.
    3. Under Condition Requirements, select **None-Get All Beneficiary Records**.
    4. Under How Many Records to Store, select **All Records**.

## Add and Configure a Screen Element

1. To add a screen element, after the Get Records element, click ![The plus sign icon to add an 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_builder_add_element_plus.png) and select **Screen**.
2. In the screen properties editor, for the Label field, enter Add Beneficiaries. The API Name auto-populates.

## Add and Configure a Repeater Component

The prepopulated items output in a Repeater support variables of only the record collection data type. For the Default Value or the Value field in the child components, use the variable that’s automatically created by the Get Records element.

The fields from the selected record collection variable are available to child components in the Repeater. The unique identifier for items is API name of the field. That field contains a unique identifier for each item in the collection. The field is automatically set to the object’s ID field.

In this example, we’ve used the Added Items output to collect information about newly added beneficiaries. You can expand this example and use All items, Prepopulated Items, and Removed Items. For more information, see [Flow Screen Display Component: Repeater](https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_screencmp_repeater.htm&language=en_US).

1. To add a Repeater component to the screen element, drag the Repeater component to the screen canvas.
2. To configure the Repeater properties, specify these details:
    1. For API Name, enter BeneficiaryDetails.
    2. For the Collection for Prepopulated Items field under Configure Data Source, select **Beneficiaries from Get\_Beneficiary\_Information** (1).
    3. For the Let Users Add or remove Items checkbox group, under Configure Display Options, select **Users can add items** and **Users can remove prepopulated items** (2).
        
        ![Repeater component properties editor with a collection variable selected for collection for prepopulated items and all checkboxes under configure display options selected](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_repeater_prop.png)
3. Drag a text component on the repeater and specify these details:
    1. For Label, enter Beneficiary Name. The API Name autopopulates.
    2. For Default Value, under REPEATER PREPOPULATED ITEMS, select **Beneficiaries from Get\_Beneficiary\_Information** > **Name**.
        
        ![Prepopulated Items variable selected under Default Value for the name field's text component](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_beneficiary_name.png)
4. To reduce the width of the Text component, from the Style tab, change the Width to 6 of 12 (Half Width)
5. Drag the Email component on the repeater and specify these details:
    1. For the APIName enter EmailAddress.
    2. For the Label, enter Email Address.
    3. For the Value field, under REPEATER PREPOPULATED ITEMS, select **Beneficiaries from Get\_Beneficiary\_Information** > **Email\_Address\_\_c**
6. To reduce the width of the Email component, from the Style tab, change the Width to 6 of 12 (Half Width).
7. Drag a long Text Area on the repeater and specify these details:
    1. For Label, enter Beneficiary Address.
    2. For Default Value, under REPEATER PREPOPULATED ITEMS, select **Beneficiaries from Get\_Beneficiary\_Information** > **Address\_\_c**
8. On the screen editor, click **Done**.

## Create a Single Value Record Variable to Store Added Items

The single-value record variable `addedBeneficiaryDetails` stores the field values for a beneficiary.

From the Toolbox, add a new resource and specify these details:

1. Under Resource Type, select **Variable**.
2. For API Name, enter addedBeneficiaryDetails.
3. Under Data Type, select **Record**.
4. Under Object, select **Beneficiary**.
5. Click **Done**.

## Create a Collection Variable to Store All Added Items

The values from the `addedBeneficiaryDetails` variable are iteratively added to a record collection variable, `beneficiaryCollection`. The record collection variable is then used to create beneficiary records.

From the Toolbox, add a new resource and specify these details:

1. Under Resource Type, select **Variable**.
2. For API Name, enter beneficiaryCollection.
3. Under Data Type, select **Record**.
4. Under Object, select **Beneficiary**.
5. Select **All multiple values (collection)**
6. Click **Done**.

## Add and Configure a Loop Element

To process the output of the Repeater add a loop element.

After the screen element, add a Loop element and specify these details:

1. For the Label, enter Loop through Added Items. The API Name autopopulates.
2. For the Collection Variable, under SCREEN, select **Add Beneficiaries** > **Beneficiary Details** > **Added Items**
    
    ![Screen resource Add Beneficiaries selected under 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/automate_flow_build_loop_collection_var.png)
    
    ![Added Items selected under Outputs for the 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/automate_flow_build_added_items.png)

## Add and Configure an Assignment Element to Collect Beneficiary Details

For each added item, the assignment element assigns the fields from the single-value record variable to the record collection variable.

1. After For Each under the loop, click ![The plus sign icon to add an 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_builder_add_element_plus.png) to add an Assignment element.
2. For the Label, enter Add Beneficiary Details. The API Name autopopulates.
3. To set the values for the Beneficiary name, specify these values:
    1. For Variable, under Record Variables, select **addedBeneficiaryDetails** > **Beneficiary Name**
    2. For Operator, select **Equals**.
    3. For Value, under Loop, select **Current Item from Loop Loop Through Added Items** > **Beneficiary Name**
4. To set the values for email Address, enter these values:
    1. Click **Add Assignment**.
    2. For Variable, under Record Variables, select **addedBeneficiaryDetails** > **Email address**.
    3. For Operator, select **Equals**.
    4. For Value, under Loop, select **Current Item from Loop Loop Through Added Items** > **Email Address**.
5. To set the values for Address, enter these values:
    1. Click **Add Assignment**.
    2. For Variable, under Record Variables, select **addedBeneficiaryDetails** > **Address**
    3. For Operator, select **Equals**.
    4. For Value, under Loop, select **Current Item from Loop Loop Through Added Items** > **Beneficiary Address**
6. To add the beneficiary details to a record collection variable that'll be used in the Create records element, enter these values:
    1. Click **Add Assignment**.
    2. For Variable, select **beneficiaryCollection**.
    3. For Operator, select **Add**.
    4. For Value, select **addedBeneficiaryDetails**.

## Add and Configure a Create Records element to Create Newly Added Beneficiaries

1. After the Loop element, add a Create Records element.
2. To configure the Create Records element, specify these values:
    1. For Label, enter Add New Beneficiaries. The API Name autopopulates.
    2. For How Many Records to Create, select **Multiple**.
    3. Under Record Collection, select **beneficiaryCollection**.
3. Save the flow.
4. For the Flow Label, enter Add Beneficiary Information. The API name autopopulates.
5. Click **Save**.
    
    ![Complete flow to Add Beneficiaries during run time.](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_flow.png)

Run the flow and add one or more beneficiaries. Go back to the Beneficiary Record page and see the newly added beneficiaries under the All Beneficiaries related list.