cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Barber_Chris
Helper III
Helper III

Send single email following apply to each no match

Hi,

I have a flow that checks an email address when it arrives against a sharepoint list and if there is a match it sends the email for approval. 

 

What im wanting to do is send a single email to myself is there is no match but what im getting multiple emails. 

 

Im aware that this is because its in apply to each so an email is sent for each record but i cant think of a way it woud work to send a single email. 

 

Any help would be appreciated. 

 

Regards

Chris

2 REPLIES 2
Barber_Chris
Helper III
Helper III

Untitled.png

Hi @Barber_Chris 

 

Have you tried using the ODATA Filter Query for this? If not, please refer to the screenshot below. It will ease the process a lot more. slsa.png

Here, Datbase is my SharePoint List with the FirstEmail and SecondEmail columns and I am querying those to get only the items that have the email address of the person who sent the email. Please note that the ODATA filter does not support special characters and spaces in the column names so you might have to make those changes on the sharepoint list. 

In the condition action, I am checking the length of the get items list and if it is not zero (i.e., there is an email match) I am creating an apply to each loop to send the approvals. and if it is zero that is there is no match then I send an email to myself. 

Expression used in the condition:

length(body('Get_items')?['value'])

Do you think this works for your scenario? 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (83,422)