Awhile ago I made an article on how to loop through a process. The purpose of looping is to do something with multiple records, there is another way of doing that but instead of looping through records you use a collection. The idea is that you can read a collection of records by using a read data task and then pass that collection to another process and it will execute the other process for each of the records in the collection one at a time. The second process works like you’re just using it for a single record.
In this example I will set up a process to email contacts that have a meeting this week to remind them about the activity. First you will want to set up the process that will be sending the email, so you’ll want to start it by adding a unique identifier parameter that’ll you’ll use for the contact later on. Remember you’re building this process to work for one single record which will be the id that is in the process parameter.
Then you want to do a read data to read the contact where contact equals the unique identifier, then you’ll read the contacts activities where the date is the current week and the contact equals the id of the contact you just read. Then you’ll put a send email.
Now you’ll create the second process that you’ll get the collection from.
This process is going to get all the contacts you’re going to send this email to and it will call the first process we made for all of those contacts. First you’ll do a read data and read contact again but this time when it asks you which data read mode do you want to use you’ll select “Read collection of records”.
The next part is to add a sub process to call the process that we just made. You add it like any sub process but the important part is how we map what we’re putting in the process parameter. Since we’re reading a collection of records it looks a little bit different.
When you select the read contact task to map to the process parameter it shows it is coming from a collection of records. Also notice in the image above that it is coming from a collection of records. This is letting you know that it will execute the process for every record in the collection. So basically it’s doing the looping for you. It’s looping through each record in the collection and executing the process for each record one at a time.
There’s valid reasons to loop in a process and also valid reasons to read a collection. Using collections does require two separate processes but it’s nice to not have to use a field to flag the records and is a little simpler to use a collection.