cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Email triggered from SP modified, list of recipients lookup from SP list dependent on column values

I will attempt to explain this but shout if it doesn't make sense -

 

SharePoint List 'A' linked to an app and has many uses updating various data columns on various items

As well as for 'new items created' there is also a range of different Emails generated to notify people of different columns being updated on the items.

All good so far and straight forward.

 

But I have an admin screen in my app where different administrators are listed (pulled from a separate List 'B') and in that list is a few columns which store which administrators want which notifications to be emailed to them, via a yes/no choice stored in each column against that users record.

 

So to single out a particular use case - 

How do I filter to just those users who have selected 'yes' to a particular notification (in this case we will say 'new item created'), and hence get their email addresses into the 'To' box on a flow?

 

Any help or suggestions appreciated

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @DarkWizard 

Assuming that the list B has a People column, let's call it "Recipient" and a Yes/No column, let's call it "New item created" (internal name "NewItemCreated" - I don't like spaces).

 

In the Get items action for list B, using the above information, fill the "Filter Query" field as:

NewItemCreated eq 1

where 1 means Yes in that column! Note that I am using the internal name!

 

Now you just need to loop through each item retrieved and append the Recipient (email address) to an Array variable (must be initialized before).

 

After the loop, use a Condition to check if any items were retrieved (length(Get items) > 0) and if so, send the email to all the recipients that you have in the Array variable ( To field: join(Recipients,',') ) - use comma or semicolon as the field requests!

Kind regards, John

 

View solution in original post

3 REPLIES 3
Super User
Super User

Hello @DarkWizard 

Assuming that you have a flow for list A that triggers when a new item is created.

First step then is to get items from list B where Yes is marked for "new item created".

Collect all the email addresses into an Array variable from the items from list B.

Send one email to the email addresses collected in the Array variable, adding them to the To field using a join expression.

 

That should do it for that scenario.

Kind regards, John

Hi John.

Yes that sounds spot on, and sort of thing i was thinking.

I had tried previously with the 'Get Items' thing but kept coming unstruck when coming up with the formula for pick the relevant email address for the variable. I had tried if and filter statements but didn't get anywhere. Any suggestion as a starting point on what would be best method?

 

Thanks again.

 

Hello @DarkWizard 

Assuming that the list B has a People column, let's call it "Recipient" and a Yes/No column, let's call it "New item created" (internal name "NewItemCreated" - I don't like spaces).

 

In the Get items action for list B, using the above information, fill the "Filter Query" field as:

NewItemCreated eq 1

where 1 means Yes in that column! Note that I am using the internal name!

 

Now you just need to loop through each item retrieved and append the Recipient (email address) to an Array variable (must be initialized before).

 

After the loop, use a Condition to check if any items were retrieved (length(Get items) > 0) and if so, send the email to all the recipients that you have in the Array variable ( To field: join(Recipients,',') ) - use comma or semicolon as the field requests!

Kind regards, John

 

View solution in original post

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (3,642)