cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OzmeR
Level: Powered On

Collecting data from Text Input and sending e-mail

Hi.

 

I`m trying to have a checkbox where when it`s checked it gathers information from a Text_Input. The text_input is where a user will type his/her e-mail, and when the checkbox is checked, an confirmation e-mail is sent to the e-mail that the user has provided. 

 

Please see attached picture of the code I have tried. 

 

I`m fairly new to PowerApps, and not sure what I`m doing.. 

 

Thanks. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
QJappie22
Level 8

Re: Collecting data from Text Input and sending e-mail

It might also be better to put the Submit function after you send the mail. Like this:

If(Checkbox1.Value, Office365.SendEmail(DataCardValue_emailAddress.Text, "Confirmation email", DataCardValue_emailBody.Text));
SubmitForm(EditForm1)

View solution in original post

9 REPLIES 9
QJappie22
Level 8

Re: Collecting data from Text Input and sending e-mail

Hi @OzmeR,

 

The code you used in the OnCheck property of the CheckBox can better be placed in the OnSelect property of the Submit button. Then if you select the Submit button AND the CheckBox is checked, it sends an email to the requestor. If the CheckBox is NOT checked, it doesn't send an email to the requestor after selecting the Submit Button.

I hope this will help you with your question!

OzmeR
Level: Powered On

Re: Collecting data from Text Input and sending e-mail

Hi. @QJappie22

 

Thanks for your answer, I tried to do that just now, but I get an error in formula.. 
Do you know what could be wrong with it, please see attached image. 

 

Thanks.

Super User
Super User

Re: Collecting data from Text Input and sending e-mail

Hi @OzmeR 

The correct way to do this is to terminate the call to the SubmitForm function with a semi colon. You can then append your sendmail code beneath like so.

 

SubmitForm(EditForm1); 
If (Checkbox1.Value,
    Office365.SendEmail(... etc

 

OzmeR
Level: Powered On

Re: Collecting data from Text Input and sending e-mail

Hi @timl 

 

Thanks for your reply. 

I just tried that as well, but I still keep getting the error on formulas. It keeps telling me: Invalid number of arguments: received 2, expected 3-4. Button_Submit.OnSelect

 

I have tried as following: 

 

"SubmitForm(EditForm1);
If (Checkbox1.Value,
   Office365.SendEmail(Input_Email, "Confirmation email")"

 

and 

 

"SubmitForm(EditForm1);
If (Checkbox1.Value=true)
   Office365.SendEmail(Input_Email, "Confirmation email")"

 

and 

 

"SubmitForm(EditForm1);
If (Checkbox1.Value,true) 
   Office365.SendEmail(Input_Email, "Confirmation email")"

 

and 

 

"SubmitForm(EditForm1);
If (Checkbox1.Value;true) 
   Office365.SendEmail(Input_Email, "Confirmation email")"

 

and

 

"SubmitForm(EditForm1);
If (Checkbox1.Value=true) 
Office365.SendEmail(Input_Email, "Confirmation email"),COncatenate(Input_Email))"

 

and so on and so on.. 

 

I really cannot figure out why this is so difficult to do.. It`s so easy to define a e-mail address to send to, but not when you want the user of the app to type in the e-mail address they want to receive a copy to..

 

Thanks. 

OzmeR
Level: Powered On

Re: Collecting data from Text Input and sending e-mail

I have also tried with: " SubmitForm(EditForm1); If(Checkbox1.Value=true); If(Input_Email.Value, Office365.SendEmail(Input_Email.Text, "Subject" , "Confirmation e-mail"),false;SubmitForm(EditForm1) "

 

But this also gives me errors..

QJappie22
Level 8

Re: Collecting data from Text Input and sending e-mail

Hi @OzmeR,

 

The Office365.SendEmail function expects 3 parameters. So you formula should be:

SubmitForm(EditForm1);
If(Checkbox1.Value, Office365.SendEmail(DataCardValue_emailAddress.Text, "Confirmation email", DataCardValue_emailBody.Text))

DataCardValue_emailAddress must be replaced by the name of your DataCard name for the requestor. Same goes for DataCardValue_emailBody: replace this with your DataCard name for the Body of the email.

Don't forget to put .Text after the DataCard names.

 

Does this do the trick for you?

QJappie22
Level 8

Re: Collecting data from Text Input and sending e-mail

It might also be better to put the Submit function after you send the mail. Like this:

If(Checkbox1.Value, Office365.SendEmail(DataCardValue_emailAddress.Text, "Confirmation email", DataCardValue_emailBody.Text));
SubmitForm(EditForm1)

View solution in original post

Super User
Super User

Re: Collecting data from Text Input and sending e-mail

Hi @OzmeR 

Can you try this and see if you get the same error?

SubmitForm(EditForm1); 
If (Checkbox1.Value,
    Office365.SendEmail(Input_Email.Text, "Email Subject", "Email Body")
)
OzmeR
Level: Powered On

Re: Collecting data from Text Input and sending e-mail

Hi @QJappie22 

 

Holy moly! It worked!! I have been pulling my hair out for days trying to get this sorted! 

Thank you so much for your help!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 103 members 5,098 guests
Please welcome our newest community members: