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.
- 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.
- For Label, enter
- 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
.
- For Resource, select the Contacts from Get_Contacts_from_Text_Collection screen component.
- For Resource, select the Contacts from Get_Contacts_from_Text_Collection screen component.
- In the Target Data box, click
.
- For Data Type, select Record.
- Select Allow multiple values (collection).
- For Object, select Campaign Member.
- Click Create.
- For Data Type, select Record.
- For Label, enter
- Connect the Source Data column's Id field to the Target Data column's ContactId field.
- In the Target Data column, click the CampaignId row, then click
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
to return to the mapping panel.
- In the “Search a field” field, select varCampaignID.
- In the Target Data column, click the Status row, then click
and select Value.
- In the Enter Value window, enter
Planned.
- Click Done.
- In the Enter Value window, enter
- 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.
- For Label, enter
- Save the flow.

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.