Create or Update a Contact | 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. Locate the text reading Create New, and click the first Add Element button directly below it. The position should be between Update or Create and End (Create New)
  2. Select Create Records from the menu.
  3. In the New Create Records window, enter these values
    Field Value
    Label Create Contact
    API Name Create_Contact
    Record  {!contact}
  4. Activate the Done button.
  5. Verify that the newly added element is connected correctly to the Create New outcome path.
  6. Activate the Save button.

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. Locate the text Update Existing near the bottom of the page below the decision element. Click the Add Element button below it.
  2. Choose Assignment from the menu.
  3. In the New Assignment window, enter these values.
    Field Value
    Label Set Contact ID
    API Name Set_Contact_ID
  4. Under the Set Variable Values heading, enter these values.
    Variable Operator Value
    {!contact.Id} Equals {!Find_a_Match.Id}
  5. Simply TAB out of the field list after pasting the value from above.
  6. Activate the Done button.
  7. Verify that Set Contact ID is located below Update Existing under the Update or Create? decision element on the canvas.
  8. Activate the Save button.

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. On the canvas below the Elements heading, locate the Assignment Element, Set Contact ID button. Activate the Add Element button below it.
  2. Choose Update Records from the menu.
  3. In the New Update Records window, enter these values.
    Field Value
    Label Update Contact
    API Name Update_Contact
    Record or Record Collection {!contact}
  4. Activate the Done button.
  5. Verify that Set Contact ID is located above Update Contact on the canvas.
  6. Activate the Save button.

 

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.

  

Click to return to Trailhead to verify this step.