You cannot use the Select action in this way. If you are using the text mode (shown below) you need to provide valid JSON or insert a single dynamic content item.
In your case, you need to use the Map mode. Note: Customize the key to suit your preference. The text entered in the key field can be ANYTHING.
Run a test to review the outputs. It should look something like this:
[
{
"Employee": "employee1@example.com",
"Supervisor": "supervisor1@example.com"
},
{
"Employee": "employee2@example.com",
"Supervisor": "supervisor2@example.com"
},
{
"Employee": "employee1@example.com",
"Supervisor": "supervisor1@example.com"
},
{
"Employee": "employee3@example.com",
"Supervisor": "supervisor3@example.com"
},
{
"Employee": "employee4@example.com",
"Supervisor": "supervisor4@example.com"
},
{
"Employee": "employee2@example.com",
"Supervisor": "supervisor2@example.com"
}
]
Compose Unique List
The Select action will output an array of the employee email address and their supervisor. You'll need to gather a unique list. Use a Compose action and the union() function.
The union() function takes two arrays. It'll combine them and remove any duplicates. Insert an expression and use the union() function.
Click on the Dynamic Content tab and insert the output from the Select action above. Add a comma and insert the output from the Select action above again.
The output would looks something like this:
[
{
"Employee": "employee1@example.com",
"Supervisor": "supervisor1@example.com"
},
{
"Employee": "employee2@example.com",
"Supervisor": "supervisor2@example.com"
},
{
"Employee": "employee3@example.com",
"Supervisor": "supervisor3@example.com"
},
{
"Employee": "employee4@example.com",
"Supervisor": "supervisor4@example.com"
}
]
Run a test and review the outputs.
Apply to Each
Use the Apply to Each action to loop through each of the "unique pairs" (the output from the Compose action above)
To help you better understand what you are looping through. Add a Compose action and insert the Current Item into the Compose action. Run a test.
Review the output of the Compose action. It should look like this:
{
"Employee": "employee1@example.com",
"Supervisor": "supervisor1@example.com"
}
To output the employee email address and the supervisor email address separately you need to use an expression. The item() function is what you'll need to use along with the dynamic content key (text in red).
item()?['dynamic content key here']
For example—to return the employee email address I will use the Employee dynamic content key. Your dynamic content key may be different. Ensure you are using the correct dynamic content key.
item()?['Employee']
This expression will return the employee email address of the current item being looped through. Insert a Compose action and the expression and run a test.
Repeat this for the Supervisor email address. Now you can use the outputs of these Compose actions in the Send an Email (V2) action.
Hope this helps!