cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kumar9024021
Helper V
Helper V

Dropdown selected value not updating in email template - SendEmail

I have a powerapps screen where I am sending email OnSubmit button click while creating new item, with SharePoint as the datasource.

 

I have written below piece of code, however the selected dropdown value (highlighted in red) doesn't get updated in email template, when email is sent. All other values in email template are updated successfully.

 

Office365Outlook.SendEmail("abc@def.com","Please approve my leave",
"<html>
<head>
<meta http-equiv=""Content-Type"" content=""text/html; charset=us-ascii"">
</head>
<body>
<p>Hi "& DataCardValue12.Selected.displayName &",</p>
<p>Please click on the below link to approve (or) reject the leave request request submitted by " & DataCardValue1.Text & ".<br/></p><p>https://web.powerapps.com/apps/YYYY-YYYY-YYYY-YYYY?Id=" & NewForm.LastSubmit.ID & "
</p>
Regards<br/>
Admin
</p>
</body>
</html>"

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Kumar9024021 ,

 

Could you try to put Set( MyVariable ,DataCardValue12.Selected.DisplayName) to OnChange property of combo box and put the following codes to OnSelect of submit button?

 

SubmitForm(FormName);
Office365Outlook.SendEmail("abc@def.com","Please approve my leave","<html>
<head>
<meta http-equiv=""Content-Type"" content=""text/html; charset=us-ascii"">
</head>
<body>
<p>Hi "&MyVariable&",</p>
<p>Please click on the below link to approve (or) reject the leave request request submitted by
</p>
Regards<br/>
Admin
</p>
</body>
</html>")

 

 

If it still doesn't work, please post back the Items proeprty of DataCardValue12 and the OnSelect of Submit button.

Best regards,

Sik

 

 

View solution in original post

3 REPLIES 3
v-siky-msft
Community Support
Community Support

Hi @Kumar9024021 ,

 

Try to save the drop down selection to a variable before submitting the form, then apply the variable to the code.

1. Put Set(MyVariable, DataCardValue12.Selected.displayName) before SubmitForm function.

2. Modify codes as below:

Office365Outlook.SendEmail("abc@def.com","Please approve my leave",
"<html>
<head>
<meta http-equiv=""Content-Type"" content=""text/html; charset=us-ascii"">
</head>
<body>
<p>Hi "MyVariable  &",</p>
<p>Please click on the below link to approve (or) reject the leave request request submitted by " & DataCardValue1.Text & ".<br/></p><p>https://web.powerapps.com/apps/YYYY-YYYY-YYYY-YYYY?Id=" & NewForm.LastSubmit.ID & "
</p>
Regards<br/>
Admin
</p>
</body>
</html>")

 

Best regards,

Sik

Hi @v-siky-msft ,

 

Thanks for the response. I noticed that still it doesn't work. The dropdown value Items property is being populated at the runtime from the Office365 Connector. It is saved correctly to the SharePoint, however when I set the value in Email like below, it doesn't show correctly.

 

Also, my default value for DataCardValue12 is blank and DefaultSelectedItems is Parent.Default. Is this causing a issue ?

Hi @Kumar9024021 ,

 

Could you try to put Set( MyVariable ,DataCardValue12.Selected.DisplayName) to OnChange property of combo box and put the following codes to OnSelect of submit button?

 

SubmitForm(FormName);
Office365Outlook.SendEmail("abc@def.com","Please approve my leave","<html>
<head>
<meta http-equiv=""Content-Type"" content=""text/html; charset=us-ascii"">
</head>
<body>
<p>Hi "&MyVariable&",</p>
<p>Please click on the below link to approve (or) reject the leave request request submitted by
</p>
Regards<br/>
Admin
</p>
</body>
</html>")

 

 

If it still doesn't work, please post back the Items proeprty of DataCardValue12 and the OnSelect of Submit button.

Best regards,

Sik

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,065)