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

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
Highlighted
Community Support
Community Support

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.

View solution in original post

9 REPLIES 9
Highlighted
Community Support
Community Support

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.
Highlighted
Frequent Visitor

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. 

Highlighted
Community Support
Community Support

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.
Highlighted
Frequent Visitor

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"
}
)

Highlighted
Community Support
Community Support

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
Frequent Visitor

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. 

Highlighted
Community Support
Community Support

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.

View solution in original post

Highlighted
Frequent Visitor

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

@v-xida-msft ,

 

This really worked. 

 

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

Highlighted
Frequent Visitor

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

@v-xida-msft ,

 

OnSuccess worked as expected. 

Thank you.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (7,506)