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>"
Solved! Go to Solution.
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
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
User | Count |
---|---|
118 | |
86 | |
83 | |
74 | |
69 |
User | Count |
---|---|
214 | |
179 | |
141 | |
109 | |
83 |