cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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
Highlighted
Super User III
Super User III

Re: ForAll within a gallery and Email

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: ForAll within a gallery and Email

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Helper II
Helper II

Re: ForAll within a gallery and Email

@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. 

Highlighted
Super User III
Super User III

Re: ForAll within a gallery and Email

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,805)