cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EliasMerabet
Advocate II
Advocate II

Send an email and DataCardValues

Hello Team,

 

Trying to send an email, the content of it is something like this:

Office365Outlook.SendEmail(Dropdown2.Selected.Usuario, "Tarea Creada: " & DataCardValue58.Text & ". Usuario: " &DataCardValue65.Text & ". Número de ID: " & Text(_ID), _Contenido);

Where _Contenido es:

Set(_Contenido, Concatenate("FYI ==> Hola ", Dropdown2.Selected.Nombre, " /n /n El usuario ", _Usuario, "ha creado la tarea número ", Text(_ID), ", con título ", DataCardValue58.Text, " y cuya descripción es <", DataCardValue59.Text, ">. Las horas programas serán: ", DataCardValue60.Text));

 

As you can see, I used different approach: concatenate, & y Set a variable. Nothing work. Always the email sent shows the datacardvalues in blank.

Wha I am doing wrong?

Thanks

17 REPLIES 17

It doesn´t work. When I coded it in OnSuccess, errors appear in all Form.LastSubmit.XXX. 

I solved, storing all values in variables before of the submit, and recover them after the submit for populating the email....

@EliasMerabet Should be Self.LastSubmit.XXX in OnSuccess
What kind of errors appear? It should not be needed to use any variables here to store it - maybe you can provide more information what errors you got?

@poweractivate 
The generic error. Arguments of Concatenate are not correct or similar.
If I take out all Self.LastSubmit.XXX it will work fine. So I set the variables and send the email in Onselect of the button.

@EliasMerabet Sometimes it may need Self.LastSubmit.XXX.Value or Self.LastSubmit.XXX.Result or something like that - can you check if it works like that? You can also check by highlighting each  Self.LastSubmit.XXX - if it say Record or Table or something like that it is wrong (usually it say Record I think). So that's why it may work with Self.LastSubmit.XXX.Value or Self.LastSubmit.XXX.Result or something like that instead. Can you check if it works like that? Because it should not be needed to use any variables like that it should be available directly from the OnSuccess and exactly that value as well.

OnSuccess:

Office365Outlook.SendEmailV2(Dropdown2.Selected.Usuario, "Tarea Creada: " & Form7.LastSubmit.Title & ". Usuario: " & _MyUser & ". Número de ID: " & Form7.LastSubmit.ID, Concatenate("**FYI** <br/>Hola ", Dropdown2.Selected.Nombre, " <br/><br/> El usuario ", _MyUser, " ha creado la tarea número ", Text(Form7.LastSubmit.ID), " con fecha de creación: ", Text(Now(), "dd/mm/yyyy"),", con título ", Form7.LastSubmit.Title, " y cuya descripción es <br/><br/>==========<br/> ", Form7.LastSubmit.Descripcion, " <br/>==========.<br/><br/><b>Las horas programadas de duración de la tarea serán: ", Text(Form7.LastSubmit.'Horas Programadas'), "horas<b/>"));

OnSelect (Button):

SubmitForm(Form7);
ResetForm(Form7)

It creates the record and sends the email, but the email still has the fields of the form as blank

Thanks

@EliasMerabet 

 

Try

 

OnSelect (Button):

SubmitForm(Form7)

 

OnSuccess:

Office365Outlook.SendEmailV2(Dropdown2.Selected.Usuario, "Tarea Creada: " & Form7.LastSubmit.Title & ". Usuario: " & _MyUser & ". Número de ID: " & Form7.LastSubmit.ID, Concatenate("**FYI** <br/>Hola ", Dropdown2.Selected.Nombre, " <br/><br/> El usuario ", _MyUser, " ha creado la tarea número ", Text(Form7.LastSubmit.ID), " con fecha de creación: ", Text(Now(), "dd/mm/yyyy"),", con título ", Form7.LastSubmit.Title, " y cuya descripción es <br/><br/>==========<br/> ", Form7.LastSubmit.Descripcion, " <br/>==========.<br/><br/><b>Las horas programadas de duración de la tarea serán: ", Text(Form7.LastSubmit.'Horas Programadas'), "horas<b/>"));
ResetForm(Form7)

 

See if above works @EliasMerabet  

Works!!! Thanks!! @poweractivate 

@EliasMerabet As side note, when inside OnSuccess, it may be easier to maintain if you replace all of where it says 

 

Form7

 

with

 

Self

 

 

That also includes for the ResetForm(Self) instead of ResetForm(Form7)

 

Example:

 

OnSuccess of Form7:

 

Office365Outlook.SendEmailV2(Dropdown2.Selected.Usuario, "Tarea Creada: " & Self.LastSubmit.Title & ". Usuario: " & _MyUser & ". Número de ID: " & Self.LastSubmit.ID, Concatenate("**FYI** <br/>Hola ", Dropdown2.Selected.Nombre, " <br/><br/> El usuario ", _MyUser, " ha creado la tarea número ", Text(Self.LastSubmit.ID), " con fecha de creación: ", Text(Now(), "dd/mm/yyyy"),", con título ", Self.LastSubmit.Title, " y cuya descripción es <br/><br/>==========<br/> ", Self.LastSubmit.Descripcion, " <br/>==========.<br/><br/><b>Las horas programadas de duración de la tarea serán: ", Text(Self.LastSubmit.'Horas Programadas'), "horas<b/>"));
ResetForm(Self)

 

However if you do not like it or it causes it to stop working, just use what you have that is working now with the explicit Form7 one instead.

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,512)