Create or Update a Contact

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. From the Elements tab in the toolbox, drag Create Records onto the canvas.
  2. In the New Create Records window, enter these values.
    Field Value
    Label Create Contact
    API Name Create_Contact
    Record  {!contact}
  3. Click Done.
  4. Drag the connector node from Update or Create? onto Create Contact. Because the Decision element has multiple outcomes, you’re prompted to choose the outcome to associate with the connector.
  5. For Outcome, select Create new, and click Done.
    Canvas with five connected items
  6. 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. From the Elements tab in the toolbox, drag Assignment onto the canvas.
  2. In the New Assignment window, enter these values.
    Field Value
    Label Set Contact ID
    API Name Set_Contact_ID
  3. In the Set Variable Values section, enter these values.
    Variable Operator Value
    {!contact.Id} Equals {!Find_a_Match.Id}
  4. Click Done.
  5. Drag the connector node from Update or Create? onto Set Contact ID. Because the Decision element has only one unused outcome at this point, the connector is automatically associated with the Update Existing outcome.
    Canvas with six connected items
  6. 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. From the Elements tab in the toolbox, drag Update Records onto the canvas.
  2. In the New Update Records window, enter these values.
    Field Value
    Label Update Contact
    API Name Update_Contact
    Record or Record Collection {!contact}
  3. Click Done.
  4. Drag the connector node from Set Contact ID onto Update Contact.
    Canvas with seven connected items
  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.

Remember, you don’t have to understand much at this point. After you complete this project, move on to the Flow Builder module. There you learn about what you did in this project—and much more.

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