Skip to main content
Join the Agentforce Hackathon on Nov. 18-19 to compete for a $20,000 Grand Prize. Sign up now. Terms apply.

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. On the Create New path, click Add Element.
  2. Click Create Records.
  3. In the New Create Records window, enter these values.
    • Label: Create Contact
    • API Name: Create_Contact
    • How to set record field values: From a Record Variable
    • How Many Records to Create: One
    • Record: select the contact record variable

Your flow canvas should look like this.

The current flow, with the Create Contact element added on the Create New path

  1. 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. On the Update Existing path, click Add Element.
  2. Click Assignment.
  3. In the New Assignment window, enter these values.
    • Label: Set Contact ID
    • API Name: Set_Contact_ID
    • Variable: contact > Contact ID
    • Operator: Equals
    • Value: Contact from Find a Match > Contact ID
      The current flow, with the Set Contact ID element on the Update Existing path
  4. 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, click Add Element.
  2. Click Update Records.
  3. In the New Update Records window, enter these values.
    • Label: Update Contact
    • API Name: Update_Contact
    • How to Find Records to Update and Set Their Values: Use the IDs and all field values from a record or record collection
    • Record or Record Collection: select the contact record variable

Your flow canvas should look like this.

The completed flow, with the Update Contact element added

  1. 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.

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback