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

sending email to multiple people individually in powerapps

i have people picker control  there i can select  multiple people i want to send the email selected people individually as below

 

Office365Outlook.SendEmail(_emails, "Applause", _htmlTable, {IsHtml:true,Importance:"Normal"});

 

in _email i have collection of multiple people and in _htmlTable i have formatting of userManagerName and Department

 

How can i loop each user and how to update _htmlTable values based on each User

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@rajeshvsnk 

I would consider the following.  

First - have a placeholder in your htmlTable (which I assume is really a text variable, and not a table).  Have it something like [FULLNAME]  (ex. Hello [FULLNAME] )

 

I do not know the structure of your _email collection, so I will assume it has an EmailAddress and a FullName column in it.  You'll need to adjust the proposed solution below to fit your scenario.

 

Change your formula to the following:

ForAll(_emails,
      Office365Outlook.SendEmail(EmailAddress, 
                                 "Applause", 
                                 Substitute(_htmlTable, "[FULLNAME]", FullName), 
                                 {IsHtml:true,Importance:"Normal"}
       )
)

 

That should give you what you are looking for.

 

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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

4 REPLIES 4
RandyHayes
Super User III
Super User III

@rajeshvsnk 

I would consider the following.  

First - have a placeholder in your htmlTable (which I assume is really a text variable, and not a table).  Have it something like [FULLNAME]  (ex. Hello [FULLNAME] )

 

I do not know the structure of your _email collection, so I will assume it has an EmailAddress and a FullName column in it.  You'll need to adjust the proposed solution below to fit your scenario.

 

Change your formula to the following:

ForAll(_emails,
      Office365Outlook.SendEmail(EmailAddress, 
                                 "Applause", 
                                 Substitute(_htmlTable, "[FULLNAME]", FullName), 
                                 {IsHtml:true,Importance:"Normal"}
       )
)

 

That should give you what you are looking for.

 

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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Can you pls explain with html content also.

I am getting sysntax error substitute saying syntax wrong arguments

 Substitute(_htmlTable, "[FULLNAME]", FullName), 
                                 {IsHtml:true,Importance:"Normal"}

 

Hai Randy ,

Thanks for your quick response.

It working fine but i want to pass 5 parameter like email and name,department,manager & Designation 

how we can do it

 

ForAll(_emails,
      Office365Outlook.SendEmail(EmailAddress, 
                                 "Applause", 
                                 Substitute(_htmlTable, "[FULLNAME]", FullName), 
                                 {IsHtml:true,Importance:"Normal"}
       )
)

@rajeshvsnk 

So, I'm assuming you got it to work.  Your first response seemed to indicate you were having problems, but your next response seemed to indicate you have it working.

 

As for multiple substitutions, just nest them...like this example for three of them:

ForAll(_emails,
      Office365Outlook.SendEmail(EmailAddress, 
                                 "Applause",
                                 Substitute( 
                                  Substitute(
                                   Substitute(_htmlTable, 
                                    "[FULLNAME]", FullName), 
                                    "[DEPARTMENT]", Department),
                                    "[DESIGNATION]", Designation
                                 ),
                                 {IsHtml:true,Importance:"Normal"}
       )
)

 

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA 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

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,042)