cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DarkWizard
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
JohnAageAnderse
Memorable Member
Memorable Member

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

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (1,168)