Skip to main content
From 16:00 UTC on January 17, 2026, to 20:00 UTC on January 17, 2026, we will perform planned maintenance on the Trailhead, myTrailhead, and Trailblazer Community sites. During the maintenance, these sites will be unavailable, and users won't be able to access them. Please plan your activities around this required maintenance.

Estimación de tiempo

Temas

Preguntar a la comunidad

Transform Selected Contacts into Campaign Members

When the loop finishes processing all the selections and the selected account IDs are in a structured format (the txtcollSelectedAccounts collection), you can use the collection as criteria to get the related records that you really need: the contacts that are related to the selected accounts. The flow can then add those contacts to a campaign as campaign members.

  1. On the Is Null path, create a Get Records element that retrieves all of the contacts from the selected accounts.
    • For Label, enter Get Contacts from Text Collection.
    • Make sure the API Name is Get_Contacts_from_Text_Collection.
    • For Object, select Contact.
    • For Condition Requirements, select All Conditions Are Met (AND).
    • For Field, select Account ID.
    • For Operator, select In.
      The In operator works only for non-record collection variables, and allows you to use the contents of a collection variable as filter criteria.
    • For Value, select txtcollSelectedAccounts.
    • For How Many Records to Store, select All records.
    • For How to Store Record Data, select Automatically store all fields.
  2. After the Get Contacts from Text Collection element, create a Transform element that converts those contacts into campaign member records.
    • For Label, enter Transform Contacts to Campaign Members.
    • Make sure the API Name is Transform_Contacts_to_Campaign_Members.
    • In the Source Data box, click Add flow resource for source data.
      • For Resource, select the Contacts from Get_Contacts_from_Text_Collection screen component.
    • In the Target Data box, click Add flow resource for target data.
      • For Data Type, select Record.
      • Select Allow multiple values (collection).
      • For Object, select Campaign Member.
      • Click Create.
  3. Connect the Source Data column's Id field to the Target Data column's ContactId field.
  4. In the Target Data column, click the CampaignId row, then click Add or edit formula and select Formula.
    • In the “Search a field” field, select varCampaignID.
      The formula should now contain the text {!varCampaignID}.
    • In the Add Transformation panel, click Back to map your data to return to the mapping panel.
  5. In the Target Data column, click the Status row, then click Add or edit formula and select Value.
    • In the Enter Value window, enter Planned.
    • Click Done.
  6. After the Transform Contacts to Campaign Members element, add a Create Records element that adds the transformed campaign member records to the org's database.
    • For Label, enter Create Campaign Members.
    • Make sure the API Name is Create_Campaign_Members.
    • For How to set record field values, select From a Record Variable.
    • For How Many Records to Create, select Multiple.
    • For Record Collection, select Campaign Members from Transform Contacts to Campaign Members.
  7. Save the flow.
    The flow builder canvas corresponding to the preceding steps.

Phew! That flow’s a bit of a monster, a real Flowzilla. But you can use this manual loop whenever you need to cycle through selections, even if they’re not record IDs.

Comparta sus comentarios sobre Trailhead en la Ayuda de Salesforce.

Nos encantaría conocer su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios cuando quiera desde el sitio de la Ayuda de Salesforce.

Más información Continuar para compartir comentarios