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.
- In the Create New path, hover over and click .
- Click Create Records.
- In the New Create Records window, enter these values.
Field Value Label Create Contact
API Name Create_Contact
Record Select the contact record variable
- Your flow canvas should look like this.
- 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.
- In the Update Existing path, hover over and click .
- Click Assignment.
- In the New Assignment window, enter these values.
Field Value Label Set Contact ID
API Name Set_Contact_ID
- In the Set Variable Values section, enter these values.
Variable Operator Value contact > Id
Equals Contact from Find_a_Match > Id
- 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.
- After the Set Contact ID element, hover over and click .
- Click Update Records.
- 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
- Your flow canvas should look like this.
- 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.