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.
Solved! Go to Solution.
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)
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!
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.
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
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.
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..
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?
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)
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") )
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!
User | Count |
---|---|
236 | |
113 | |
94 | |
59 | |
31 |
User | Count |
---|---|
286 | |
132 | |
106 | |
63 | |
57 |