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

ForAll within a gallery and Email

All, 

 

I have a gallery, in which I need to send an email to everyone in the gallery. Right now in my test case, I have two records and I do get two emails, but the data within the emails are the same. It is pulling the last record only and sending it twice. 

 

Everything works as far as the SendEmail. The ForAll finds 2 records, but it finds the same record twice, not 1 and 2. Any advice? There will only be 5-10 records max in this gallery at any point in time. It would be possible to select each one and hit the send button, but I'm trying to only have someone hit the send button once for everyone in the gallery. Thank you in advance. 

 

Below is my code

 

ForAll(Gallery7_16.AllItems, Office365Outlook.SendEmail(LookUp(BIS_PMs,'Name (Title)' = Gallery7_16.Selected.'Project Manager'.Value, Email) & ";" & LookUp(BIS_PROJECT, 'Project Name' = Gallery7_16.Selected.Project,'Engagement Manager'.Email),
"BIS Master Data - Employee BIS " & Gallery7_16.Selected.'Resource Name' & " is about to expire.",
"The employee BIS for " & Gallery7_16.Selected.Name & " is about to expire. Please review this employee BIS and resubmit an updated Billing Finish date or allow it to expire on " & Gallery7_16.Selected.'Billing Finish' & ". This person is associated with " & Gallery7_16.Selected.Project & " project, which is related to the " & Gallery7_16.Selected.Customer & " customer."))

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@chris_young 

The issue is that you are referring to the same record regardless of the ForAll.

 

Consider changing your formula to the folllowing:

ForAll(
    Gallery7_16.AllItems, 
    Office365Outlook.SendEmail(
         LookUp(BIS_PMs,'Name (Title)' = 'Project Manager'.Value, Email) & ";" & 
         LookUp(BIS_PROJECT, 'Project Name' = Project,'Engagement Manager'.Email),

         "BIS Master Data - Employee BIS " & 'Resource Name' & " is about to expire.",

         "The employee BIS for " & Name & " is about to expire. Please review this employee BIS and resubmit an updated Billing Finish date or allow it to expire on " & 'Billing Finish' & ". This person is associated with " & Project & " project, which is related to the " & Customer & " customer."
     )
)

 

 I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@chris_young 

The issue is that you are referring to the same record regardless of the ForAll.

 

Consider changing your formula to the folllowing:

ForAll(
    Gallery7_16.AllItems, 
    Office365Outlook.SendEmail(
         LookUp(BIS_PMs,'Name (Title)' = 'Project Manager'.Value, Email) & ";" & 
         LookUp(BIS_PROJECT, 'Project Name' = Project,'Engagement Manager'.Email),

         "BIS Master Data - Employee BIS " & 'Resource Name' & " is about to expire.",

         "The employee BIS for " & Name & " is about to expire. Please review this employee BIS and resubmit an updated Billing Finish date or allow it to expire on " & 'Billing Finish' & ". This person is associated with " & Project & " project, which is related to the " & Customer & " customer."
     )
)

 

 I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

 

I owe you a burger and beer. Thank you. I see what you did and what I did. It makes sense now why I was getting that error, that .selected killed me. I really appreciate you taking the time to use my data and provide something and it makes perfect sense. Thank you very much. 

@chris_young 

I'll always accept burger and beer!! 😁

No problem at all.  I am glad it was helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,446)