cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Resolver II
Resolver II

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
Highlighted
Resolver II
Resolver II

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!

Highlighted
Frequent Visitor

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.

Highlighted
Super User III
Super User III

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

 

Highlighted
Frequent Visitor

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. 

Frequent Visitor

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

Highlighted
Resolver II
Resolver II

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?

Highlighted
Resolver II
Resolver II

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

Highlighted
Super User III
Super User III

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")
)
Highlighted
Frequent Visitor

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

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

Top Solution Authors
Top Kudoed Authors
Users online (5,342)