Skip to main content

Create or Update a Contact

Note

Accessibility

This step requires some additional instructions for screen reader users. To access a detailed screen reader version of this step, click the link below:

Open Trailhead screen reader instructions.

Use a Create Records Element to Create a New Contact

Now that your flow has the logic to decide between two paths, let’s build those two paths. First, build the path for the default Create New outcome, which contains only one element.

  1. In the Create New path, hover over Add Element  and click Add Element.
  2. Click Create Records.
  3. In the New Create Records window, enter these values.
    Field Value
    Label Create Contact
    API Name Create_Contact
    Record  Select the contact record variable
  4. Your flow canvas should look like this.
    The current flow, with the Create Contact element added on the Create New path
  5. Click Save.

Now the flow can create a contact record when the Decision element executes and takes the Create New outcome’s path.

Use an Assignment Element to Set the Contact ID in the Record Variable

Let’s build the path for the Update Existing outcome. First, you need to get the record ID of the existing contact into the contact record variable.

  1. In the Update Existing path, hover over Add Element  and click Add Element.
  2. Click Assignment.
  3. In the New Assignment window, enter these values.
    Field Value
    Label Set Contact ID
    API Name Set_Contact_ID
  4. In the Set Variable Values section, enter these values.
    Variable Operator Value
    contact > Id
    Equals Contact from Find_a_MatchId
    The current flow, with the Set Contact ID element on the Update Existing path
  5. Click Save.

Use an Update Records Element to Update an Existing Contact

Now that the contact record variable contains the record ID of the matching contact, you can reference that contact record variable in an Update Records element.

  1. After the Set Contact ID element, hover over Add Element  and click Add Element.
  2. Click Update Records.
  3. In the New Update Records window, enter these values.
    Field Value
    Label Update Contact
    API Name Update_Contact
    Record or Record Collection Select the contact record variable
  4. Your flow canvas should look like this.
    The completed flow, with the Update Contact element added
  5. Click Save.

You’re all done building the flow! You can run the flow and confirm that contacts in your org are created or updated. If you’re feeling adventurous, click Debug and then Run to see the details of what your flow does as it runs.

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