---
schema_version: "1"
id: d862900d16ffa76a61e55b7a8546bc8bc86ef559a7c9672f4ff8866e179e6a53
title: Creating Records with Required Field Validation 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_required_fields.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.automate_flow_build_example_required_fields.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 6bccf66e1320ef8bf6bb75aba84febaf8d9a5f570a61c330e2ecc31e5afed2e3
description: Build a screen flow that captures all required fields and creates records without REQUIRED_FIELD_MISSING errors. This example demonstrates techniques for identifying required fields and managing errors in flows.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# Creating Records with Required Field Validation Example

Build a screen flow that captures all required fields and creates records without REQUIRED\_FIELD\_MISSING errors. This example demonstrates techniques for identifying required fields and managing errors in flows.

### 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="d323122e61">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="" id="automate_flow_build_example_required_fields__d5739e752">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d323122e61 ">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="d323122e61 ">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 shows how to build a screen flow that creates contact records and populates all required fields. Identify required fields, collect the necessary data from users, and manage errors effectively.

## Scenario

Build a screen flow that sales representatives use to create contacts quickly during prospect meetings. The flow:

- Collects all required information from the user
- Creates a contact record without errors
- Addresses cases where users leave fields blank
- Provides helpful error messages when record creation fails

For this example, use these fields as the required set:

- Last Name (standard required field)
- Email (required by organization validation rule)
- Account (required for business contacts by record type)

## Key Takeaways

- Always identify required fields before building flows that create records.
- Mark required fields as required on-screen components to prevent users from skipping them.
- Add fault paths to Data Manipulation Language (DML) operations to manage unexpected errors effectively.
- Use decision elements for complex validation logic.
- Test flows with various data scenarios, including edge cases.
- Consider using Quick Actions when you want Flow Builder to indicate required fields automatically.
- Document your flows with descriptions that list the required fields and why.

## High Level Steps

Review the steps of this example. Follow them in order or navigate to a section for more specific instructions.

- **[Create the Flow](https://help.salesforce.com/s/articleView?id=platform.automate_flow_build_example_required_fields.htm&release=264.0.0&type=5)**  
    Create the flow that collects contact information and creates a contact.
- **[Build the Data Collection Page](https://help.salesforce.com/s/articleView?id=platform.automate_flow_build_example_required_fields.htm&release=264.0.0&type=5)**  
    Create a page that collects all required contact information from users.
- **[Create the Contact Record](https://help.salesforce.com/s/articleView?id=platform.automate_flow_build_example_required_fields.htm&release=264.0.0&type=5)**  
    Now that you have the required information, it's time to create the contact.
- **[Add a Fault Path for Error Management](https://help.salesforce.com/s/articleView?id=platform.automate_flow_build_example_required_fields.htm&release=264.0.0&type=5)**  
    Configure the Create Records element to manage errors effectively.
- **[Add a Success Screen](https://help.salesforce.com/s/articleView?id=platform.automate_flow_build_example_required_fields.htm&release=264.0.0&type=5)**  
    Create a page that shows after successful record creation.
- **[Test the Flow](https://help.salesforce.com/s/articleView?id=platform.automate_flow_build_example_required_fields.htm&release=264.0.0&type=5)**  
    Thoroughly test the flow before activating it.

#### See Also

- [Creating a Salesforce Record from a Flow](https://help.salesforce.com/s/articleView?id=platform.flow_build_data_create.htm&release=264.0.0&type=5 "To create a Salesforce record, use the Create Records element. You can also use a Quick Action element of type Create, but it has limited functionality.")
- [Troubleshoot REQUIRED\_FIELD\_MISSING Errors in Flows](https://help.salesforce.com/s/articleView?id=platform.automate_flow_troubleshoot_required_field_missing.htm&release=264.0.0&type=5 "When a flow attempts to create or update a record without populating all required fields, you receive a REQUIRED_FIELD_MISSING error.")
- [Customize What Happens When a Flow Fails](https://help.salesforce.com/s/articleView?id=platform.flow_build_logic_fault.htm&release=264.0.0&type=5 "Learn how fault paths customize what happens when a flow fails. Choose how to notify admins, guide users, and take a follow-up action.")

## Create the Flow

Create the flow that collects contact information and creates a contact.

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**. Search for and select the **Screen Flow**.
    2. From Setup, click **New Flow**. Search for and select **Screen Flow**.

## Build the Data Collection Page

Create a page that collects all required contact information from users.

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. Configure the element.
    1. For Label, enter Collect Contact Information.
        
        The API Name autofills.
    2. For Description, enter Collects contact information for the contact to create.
3. Add screen components for the required fields.
    1. For the First Name field, add a **Text** component, set Label to First Name, API Name to Contact\_First\_Name, and leave Require unselected.
        
        First Name is optional for contacts.
    2. For the Last Name field, add a **Text** component, set Label to Last Name, API Name to Contact\_Last\_Name, and select Require.
    3. For the Email field, add an **Email** component, set Label to Email, API Name to Contact\_Email, and set Required to **True**.
    4. For the Account field, add a **Lookup** component, set API Name to Related\_Account, Field API Name to AccountId, Label to Account, Object API Name to Contact, and set Required to **True**.
    5. For the Phone field, add a **Phone** component, set API Name to Contact\_Phone, Label to Phone, and set Required to **False**, so it shows as an optional field.
    6. Click **Done**.

## Create the Contact Record

Now that you have the required information, it's time to create the contact.

1. Add a Create Records 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 **Create Records**.
2. Configure the element.
    1. For Label, enter Create Contact.
    2. For API Name, accept the autofilled name: Create\_Contact.
    3. For How to set record field values, select **Manually**.
    4. For Object, select **Contact**.
3. Set field values.
    1. For the last name Value, select **Collect Contact Information** and then **Last Name**.
    2. Click **\+ Add Field**.
    3. For Field, search for and select **First Name**.
    4. For the first name Value, select **Collect Contact Information**, and then select **First Name**.
    5. Click **\+ Add Field**.
    6. For Field, search for and select **Email**.
    7. For the email Value, select **Collect Contact Information** | **Contact\_Email** | **Value**.
    8. Click **\+ Add Field**.
    9. For Field, search for and select **Mobile Phone**.
    10. For the mobile phone Value, select **Collect Contact Information** | **Contact\_Phone** | **Value**.
    11. Click **\+ Add Field**.
    12. For Field, search for and select **Account ID**.
    13. For the Account ID value, select **Collect Contact Information** | **Account** | **Record ID**.

## Add a Fault Path for Error Management

Configure the Create Records element to manage errors effectively.

1. To manage errors, on the Create Records element, click the three dots, and then click **Add Fault Path**.
2. To show error information, add a Screen element in the fault path.
    1. For Label, enter Show Error Message.
    2. Accept the API name autofill.
3. Add a Message component to the error page.
    1. In the Components list, click **Message**.
    2. For API Name, enter ErrorMessage.
    3. For the Message Type, select **Critical**
    4. For Message Content, select **\+ New Resource**.
    5. For Resource Type, select **Text Template**.
    6. For API Name, enter Fault\_Message.
    7. For Body, enter We couldn't create the contact due to an error: , and then in the Insert a resource field, select **Running Flow Interview**, and then select **Fault Message**.
    8. Click **Done**.
    9. .
        
        The fault path catches unexpected errors and tells the user what went wrong.
    10. Click **Done**.
4. Add a connector to the first element.
    
    If the user can fix the error, the connector brings them back so they can change their inputs.
    
    1. After the Show Error Message screen 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 click **Connect to element**.
    2. Click the first screen element.
5. Save the flow.
    1. For Label, enter Create a Contact.
    2. Accept the autofilled API Name.
    3. For Decription, enter Creates a contact by using information collected in a screen. If there's an error creating the contact, the user is directed to the first screen to try again.

## Add a Success Screen

Create a page that shows after successful record creation.

1. To confirm success, add a Screen element after the Create Records element, on the success path.
2. Configure the screen.
    1. For Label, enter Show Success.
    2. Accept the API name autofill.
3. Add a Display Text component to the page.
    1. In the Components list, click **Display Text**.
    2. For API Name, enter SuccessMessage.
    3. In the text box, enter Contact created successfully!
4. Add a Message component to the page.
    1. In the Components list, click **Message**.
    2. For API Name, enter SuccessMessage.
    3. For the Message Type, select **Success**
    4. For Message Content, enter Contact created successfully!
    5. Click **Done**.

## Test the Flow

Thoroughly test the flow before activating it.

1. To start debugging, click **Debug**, and then click **Run**.
2. To verify successful creation, enter sample data and verify that the flow creates the contact successfully.
3. To verify field values, check that the created contact has all the expected field values.
4. Test to confirm error handling adding a duplicate record.
5. Remove the sample data before activating the flow.