Skip to main content
Stream TDX live on Salesforce+. Join virtual sessions and hands-on trainings to experience the future of software and learn how to build it.

Create or Update a Contact

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

It’s time to build the elements for the Update Existing path. First, add the existing contact’s ID to the contact record variable. Remember, having all the values in one record variable makes it easier to update the contact, and that record variable needs to know which contact to update.

  1. On the Update Existing path, click Add Element.
  2. Select Assignment.
  3. In the Assignment configuration panel, enter these values.
    • For Label, enter Set Contact ID.
      The API Name is automatically set to Set_Contact_ID.
    • For Variable, select contact > Contact ID.
    • For Operator, select Equals.
    • For Value, select Contact from Find a Match > Contact ID.
      The Flow Builder canvas corresponding to the preceding steps.
  4. Save the flow.

Use an Update Records Element to Update an Existing Contact

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

  1. After the Set Contact ID element, click Add Element.
  2. Select Update Records.
  3. In the Update Records configuration panel, enter these values.
    • For Label, enter Update Contact.
    • For API Name, enter Update_Contact.
    • For How to Find Records to Update and Set Their Values, make sure Use the IDs and all field values from a record or record collection is selected.
    • For Record or Record Collection, select the contact record variable.
      Because you selected the contact record variable, this element will update the record specified in the variable with every value stored in the variable. It’s a lot faster than selecting each field’s values one by one!
      The Update Existing path should look like this.
      The Update Existing path corresponding to the preceding steps.
  1. Save the flow.

Use a Create Records Element to Create a New Contact

Now it’s time to shift to the Not Found path. Remember, the flow runs this path when no duplicate contact is found, so it just needs to create the contact.

  1. On the Not Found path, click Add Element.
  2. Select Create Records.
  3. In the Create Records configuration panel, enter these values.
    • For Label, enter Create Contact.
      The API Name is automatically set to Create_Contact.
    • For How to set record field values, make sure From a Record Variable is selected.
    • For How Many Records to Create, make sure One is selected.
    • For Record, select the contact record variable.
      Your flow canvas should look like this.
      The Flow Builder canvas corresponding to the preceding steps.
  1. Save the flow.

All of the flow’s data elements are done, but we’re not going to just leave things there without telling the user what happened. In the next unit, you create two more screens to help keep your users informed.

Comparta sus comentarios de Trailhead en la Ayuda de Salesforce.

Nos encantaría saber más sobre su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios en cualquier momento en el sitio de Ayuda de Salesforce.

Más información Continuar a Compartir comentarios