cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
omi18
Post Patron
Post Patron

Send Email to selected People

Hello,

 

I'm trying to send an email to a bunch of people. 

 

Case 1) I have a checkbox called select all, a gallery containing people and their email addresses, and a button to send an email. What I'm trying to achieve is if I check the checkbox called "select all", then send email button should send an email to all the recipients which there in the gallery.

 

Case 2) App users can select some of the people manually by checking the checkbox from the gallery and click send email button to send an email. 

 

Any suggestion?

 

Thanks,

Omi

3 ACCEPTED SOLUTIONS

Accepted Solutions
RusselThomas
Microsoft
Microsoft

Hi @omi18 ,

 

Try this;

Put a checkbox in your gallery, call it something easy to reference, like "rowCheck" or something.

Put a checkbox outside your gallery, call it something like "checkAll"

Set the Default: property of your Gallery rowCheck to 

checkAll.Value

Now, if you check or uncheck the checkAll checkbox, it will select or deselect all checkboxes in the gallery.

You can also still check individual checkboxes in the gallery using each rows checkbox, but using the checkAll checkbox will reset them.

Now you can use the following to target only the checked items in the Gallery (whether all, or only some are selected);

ForAll(Filter(Gallery1.AllItems, rowCheck.Value), ...)

  ... is where you can put in your send mail function.  This will send one email per person though, if you want to rather send one email to all checked rows (assuming it has an email address in the row somewhere), then add a button to collect the values and then wherever you're keeping the email addresses you can run a Concat with ";" to create the To field.

Your Button OnSelect: property might then look something like this;

Clear(collectRecipients);
ForAll(Filter(Gallery1.AllItems, rowCheck.Value), Collect(collectRecipients, ThisRecord));
UpdateContext({varRecipients: Concat(collectRecipients, EmailAddressColumn, ";")})

You can then use varRecipients in the To: field for your email send.

 

Hope this helps,

 

RT

View solution in original post

RandyHayes
Super User III
Super User III

@omi18 

In your send email formula, for the recipients parameter, change to the following:

Concat(
    Filter(yourGallery.AllItems, yourCheckBox.Value), 
    emailColumnFromGallery, ";"
)

That should give you what you need.

 

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

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

View solution in original post

gabibalaban
Super User II
Super User II

Hi @omi18 

Please check my proposal too ...

 

Hope it helps !

View solution in original post

4 REPLIES 4
RusselThomas
Microsoft
Microsoft

Hi @omi18 ,

 

Try this;

Put a checkbox in your gallery, call it something easy to reference, like "rowCheck" or something.

Put a checkbox outside your gallery, call it something like "checkAll"

Set the Default: property of your Gallery rowCheck to 

checkAll.Value

Now, if you check or uncheck the checkAll checkbox, it will select or deselect all checkboxes in the gallery.

You can also still check individual checkboxes in the gallery using each rows checkbox, but using the checkAll checkbox will reset them.

Now you can use the following to target only the checked items in the Gallery (whether all, or only some are selected);

ForAll(Filter(Gallery1.AllItems, rowCheck.Value), ...)

  ... is where you can put in your send mail function.  This will send one email per person though, if you want to rather send one email to all checked rows (assuming it has an email address in the row somewhere), then add a button to collect the values and then wherever you're keeping the email addresses you can run a Concat with ";" to create the To field.

Your Button OnSelect: property might then look something like this;

Clear(collectRecipients);
ForAll(Filter(Gallery1.AllItems, rowCheck.Value), Collect(collectRecipients, ThisRecord));
UpdateContext({varRecipients: Concat(collectRecipients, EmailAddressColumn, ";")})

You can then use varRecipients in the To: field for your email send.

 

Hope this helps,

 

RT

View solution in original post

RandyHayes
Super User III
Super User III

@omi18 

In your send email formula, for the recipients parameter, change to the following:

Concat(
    Filter(yourGallery.AllItems, yourCheckBox.Value), 
    emailColumnFromGallery, ";"
)

That should give you what you need.

 

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

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

View solution in original post

gabibalaban
Super User II
Super User II

Hi @omi18 

Please check my proposal too ...

 

Hope it helps !

View solution in original post

omi18
Post Patron
Post Patron

Hi @gabibalaban,@gabibalaban@RandyHayes 

 

It worked.

 

Thanks,

Omi

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,502)