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

How to create an email with html content that's based on the last item submited

Hi,

 

I've been trying to create a notification email from powerapps that contains html text based on different datacard values of my app. I'm having multiple problems which I don't know how to solve.

Firstly, I've realized that when I write all the html text it goes to look for the values making reference to whatever I have selected from the browser gallery and that is currently selected to display in the details screen. My email was supposed to send the details of the last item submited to a sharepoint list, so whatever I had selected before was affecting the email I was getting since it was filled with the data of the item selected from the browseGallery and not the last item submited.

So I thought, well if I decouple the browse gallery from the display / edit forms and create a variable which I'll pass from screen to screen making it show the current item, I can make the details screen show the last submited item and after submiting the item to a sharepoint list, then navigate back to the details screen which now shows the last item's details. That (I thought) would make my html text show the last submited item's details in the text and email that in return. This hasn't happened.

What happens is that it sends the email with no data at all. All the email structure is there, but were there's supposed to be data it's just blank.

I don't know how to solve this and I have spent a whole night trying to find a solution to this to no avail. I was hoping someone could help me out.

 

To decouple the browsing gallery from the edit/display forms I did what's shown in this article: https://powerapps.microsoft.com/en-us/blog/decouplingbrowsegalleryfromforms/

 

Then the OnSuccess property of the EditForm is set to this: 

Navigate(DetailScreen1, ScreenTransition.None, {displayItem:EditForm1.LastSubmit}); Office365.SendEmail("p***@s***.com.ar", "Nueva factura N°: " & DataCardValue2.Text & " de" & DataCardValue8.Selected.DisplayName,HtmlCorreoNot.HtmlText, {IsHtml:true})

 

This only shows the DataCardValue2.Text in the email subject, but not the DataCardValue8.Selected.DisplayName (which since I'm a total newbie, I tried converting to text to see if that had any effect whatsoever but it didn't).

 

My html text is hosted in a new screen which is out of reach for users but where I've placed an htmltext control and written the following: 

 

"Buenos días," & "<br>" &
DataCardValue8.Selected.DisplayName & " ha cargado una nueva factura a Sharepoint. Estos son los datos relevantes:"& "<br>"
& "<b> Nombre del proveedor: </b>" & DataCardValue9.Text & "<br>"
& "<b> Nro de factura: </b>" & DataCardValue10.Text & "<br>"
& "<b> Centro de costo: </b>" & DataCardValue16.Selected.Value & "<br>"
& "<b> Rubro: </b>" & DataCardValue11.Selected.Value & "<br>"
& "<b> Subrubro: </b>" & DataCardValue12.Selected.Value & " " & "(" & DataCardValue13.Selected.Value & ")" & "<br>"
& "<b> Monto: </b>" & "$" & DataCardValue18.Text & "<br>"
& "<b> Vínculo a factura en SP: </b>" & "<br>"
& "<br>" & "Por favor, carguela al sistema B**** como también a InfoM. Como adjunto encontrará el archivo que contiene la factura." & "<br>" & "<br>"
& "Gracias," & "<br>"
& "S*** S.A." & "<br>"
& "<br>"
& "Este es un mensaje autogenerado a partir de la carga de una factura, no lo ha enviado el remitente"

 

Where:

  • DataCardValue 2 is hosted on the DetailScreen1 (and this value does show the correct data in the email as receive as a notificaiton)
  • DataCardValue 8 is the Author in the DetailScreen in the DetailForm1
  • DataCardValue 9 through 18 Are all values found in the EditForm1

 

 

 

At first, during the first tests, it would not show the datacardvalues that would be followed by the ".selected.value". But now it's just not showing anything because of what I've already explained above (just to clarify, after the decoupling, I did some tests and that's what happened, first it seemed to work and send the email correctly showing all the fields of the last submited items, but in subsequent tests it just showed all fields blank).

 

So..I really have no clue on what to do..I'm super new to powerapps but want to move forward, I've invested a lot of hours on this and hope my problem does have a solution. If any of you pros can help me I'll be eternally grateful! =)

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

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

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 29 members 4,368 guests
Please welcome our newest community members: