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

Office365.SendEmail("xxx", "", "")

Hi team, 

 

I want to send an email to an Office 365 user being selected in a combo box when I submit a form using a button. 

 

I don't want to use Office365.SendEmail("xxx@xyz.com", "Subject", "Body") because the To..... should be dynamic.

Kindly help.  

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Office365.SendEmail("xxx", "", "")

Hi @power254 ,

Based on the issue that you mentioned, I think this issue may be related to the reset of your Edit form.

When the SubmitForm(EditForm1) formula is executed successfully, your Edit form would be reset automatically. So the result the DataCardValue64.Selected.Email formula would return blank.

 

On your side, please consider put your Office365.SendEmail() formula within the OnSuccess property of the Edit form. Set the OnSuccess property of the Edit form to following:

Office365.SendEmail(
EditForm1.LastSubmit.YourPersonColumn.Email, /* <-- EditForm1 represents the Edit form in your app */ "New Accrual Request",
User().FullName & " Sent you a new request, please approve it.", { IsHtml: true, Importance: "Normal" } )

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
9 REPLIES 9
Community Support Team
Community Support Team

Re: Office365.SendEmail("xxx", "", "")

Hi @power254 ,

Could you please share a bit more about the Combo Box within your Edit form? Could you please show more details about the formula typed within the Items property of the Combo Box?

How do you submit your form data to your data source? Using SubmitForm() function?

Further, could you please share a bit more about your data source? Is it a SP list?

 

I have made a test on my side, please take a try with the following workaround:5.JPG

Set the OnSelect property of the "Submit" button to following:

SubmitForm(EditForm1);
Office365.SendEmail(
EditForm1.LastSubmit.Manager.Email, /* <-- Manager represents the Person type column in my SP List data source */
"PowerApps Test Issue",
"This is a test email"
)

Or

SubmitForm(EditForm1);
Office365.SendEmail(
                     DataCardValue8.Selected.Email, /* <-- DataCardValue8 represents the People picker ComboBox control in my Edit form */
                     "PowerApps Test Issue", 
                     "This is a test email"
)

On your side, you should type:

SubmitForm(EditForm1);
Office365.SendEmail(
                     YourPeoplePickerComboBox.Selected.Email, /* <-- YourPeoplePickerComboBox represents the ComboBox where you selected an Office 365 user*/
                     "PowerApps Test Issue", 
                     "This is a test email"
)

Note: On my side, I use a SP list data source as data source in my app.

 

In addition, you could consider take a try to put your Office365.SendEmail() function within the OnSuccess property of the Edit form (rather than within "Submit" button):

Office365.SendEmail(
                     EditForm1.LastSubmit.YourPersonColumn.Email,
                     "PowerApps Test Issue", 
                     "This is a test email"
)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
power254
Level: Powered On

Re: Office365.SendEmail("xxx", "", "")

Hi @v-xida-msft

 

Thank you for your reply. 

 

The combo box is linked to people/ group column in SP list with the formula "Choices('source'.column name)". So I expect to display all  Office 365 users but doesn't work. I have to type the display name or email for it to display. 

 

I'm using SubmitForm() function and it works when I use Office365.SendEmail(Office365Users.Manager(User().Email).Mail, "Subject", "Body") but this sends email to only a user manager. I need the email to be sent to a selected user in the combo box. 

 

Let me try your steps below and will let you know if it worked. 

Community Support Team
Community Support Team

Re: Office365.SendEmail("xxx", "", "")

HI @power254 ,

Have you solved your problem?

 

If you have solved your problem, please go head to click "Accept as Solution" to identify this thread has been solved for other users in this forum.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
power254
Level: Powered On

Re: Office365.SendEmail("xxx", "", "")

Hi @v-xida-msft ,

I have tried but still failing with the error below. 

Office365.SendEmail failed: The method SendEmail has invalid value for parameter 'TO'

 

Here is the function - 

Office365.SendEmail(DataCardValue64.Selected.Email,
"New Accrual Request", User().FullName &
" Sent you a new request, please approve it.",
{
IsHtml: true,
Importance: "Normal"
}
)

Community Support Team
Community Support Team

Re: Office365.SendEmail("xxx", "", "")

Hi @power254 ,

I have made a test on my side, and don't have the issue that you mentioned.

Please check if the reault that your DataCardValue64.Selected.Email formula returned is a valid email address. You could consider take a try to add a Label control within your app, set the Text proeprty to following:

DataCardValue64.Selected.Email,

check if the Label control display a valid email address.

 

In addition, please consider take a try to put your Office365.SendEmail() formula within the OnSuccess property of the Edit form.

Set the OnSuccess property of the Edit form to following:

Office365.SendEmail(
EditForm1.LastSubmit.YourPersonColumn.Email, /* <-- EditForm1 represents the Edit form in your app */ "New Accrual Request",
User().FullName & " Sent you a new request, please approve it.", { IsHtml: true, Importance: "Normal" } )

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
power254
Level: Powered On

Re: Office365.SendEmail("xxx", "", "")

@v-xida-msft ,

 

Still not working. I have checked using the label as you mentioned below and it shows the correct email but the error is still coming up. 

 

However, OnSuccess Option is working. 

Community Support Team
Community Support Team

Re: Office365.SendEmail("xxx", "", "")

Hi @power254 ,

Based on the issue that you mentioned, I think this issue may be related to the reset of your Edit form.

When the SubmitForm(EditForm1) formula is executed successfully, your Edit form would be reset automatically. So the result the DataCardValue64.Selected.Email formula would return blank.

 

On your side, please consider put your Office365.SendEmail() formula within the OnSuccess property of the Edit form. Set the OnSuccess property of the Edit form to following:

Office365.SendEmail(
EditForm1.LastSubmit.YourPersonColumn.Email, /* <-- EditForm1 represents the Edit form in your app */ "New Accrual Request",
User().FullName & " Sent you a new request, please approve it.", { IsHtml: true, Importance: "Normal" } )

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
power254
Level: Powered On

Re: Office365.SendEmail("xxx", "", "")

@v-xida-msft ,

 

This really worked. 

 

I used OnSuccess and it's now working as expected. 

power254
Level: Powered On

Re: Office365.SendEmail("xxx", "", "")

@v-xida-msft ,

 

OnSuccess worked as expected. 

Thank you.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 131 members 4,500 guests
Please welcome our newest community members: