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

Powerapps send email values are blank / missing in message body

I have a simple power app that contains an Office 365 People Picker, a dropdown "values" field and a comment text field.

I can successfully take these inputs and patch them to an Sharepoint List via a submit button (with a bit of error checking to see that they are filled in).

 

Ideally I would like to email the results on the submit as well. This is what I am trying.

Button - OnSelect

 

 

If(!IsBlank(peoplePicker.Selected.DisplayName) &&
!IsBlank(Values.SelectedText.Value),

Patch(SP_List,Defaults(SP_List),{Title:peoplePicker.Selected.DisplayName,Email:peoplePicker.Selected.Mail,Code:peoplePicker.Selected.OfficeLocation,DateEntered:Now(),Comment:Comment.Text,Value:Values.SelectedText.Value,EnteredBy:User().FullName,Award_Type:"Sticker",Points:1});Reset(Comment);Reset(Values);

Office365Outlook.SendEmail("user@domain.com","Subject Text", peoplePicker.Selected.DisplayName & " has just been given an award for " & Values.SelectedText.Value & "Comment: " & Comment.Text),



Notify( "Please ensure you fill in at least the Username and Value fields. Comments are optional.", NotificationType.Error ))

 

 

The problem is that the above code used in the OnSelect Button action is only picking up the Display Name selected using the Office 365 peoplepicker. I get an email with the username but the Value and the Comment are blank. The value and the comment are certainly valid as they patch through the Sharepoint list - so the data is there - but it doesn't appear to be there for the email function (but the username is)?

 

Any ideas? In particular why the combo box peoplepicker is coming through but not the other values? 

Any guidance is appreciated.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Adrian_Celis
Super User
Super User

Hi @whereswallyx3 

 

You are resetting your Comment and Value controls before you are sending your email so that's why it is being blank. You should reset it after you have sent the email.

If(!IsBlank(peoplePicker.Selected.DisplayName) &&
!IsBlank(Values.SelectedText.Value),

Patch(SP_List,Defaults(SP_List),{Title:peoplePicker.Selected.DisplayName,Email:peoplePicker.Selected.Mail,Code:peoplePicker.Selected.OfficeLocation,DateEntered:Now(),Comment:Comment.Text,Value:Values.SelectedText.Value,EnteredBy:User().FullName,Award_Type:"Sticker",Points:1});

Office365Outlook.SendEmail("user@domain.com","Subject Text", peoplePicker.Selected.DisplayName & " has just been given an award for " & Values.SelectedText.Value & "Comment: " & Comment.Text);

Reset(Comment);Reset(Values);
,

Notify( "Please ensure you fill in at least the Username and Value fields. Comments are optional.", NotificationType.Error ))

View solution in original post

2 REPLIES 2
Adrian_Celis
Super User
Super User

Hi @whereswallyx3 

 

You are resetting your Comment and Value controls before you are sending your email so that's why it is being blank. You should reset it after you have sent the email.

If(!IsBlank(peoplePicker.Selected.DisplayName) &&
!IsBlank(Values.SelectedText.Value),

Patch(SP_List,Defaults(SP_List),{Title:peoplePicker.Selected.DisplayName,Email:peoplePicker.Selected.Mail,Code:peoplePicker.Selected.OfficeLocation,DateEntered:Now(),Comment:Comment.Text,Value:Values.SelectedText.Value,EnteredBy:User().FullName,Award_Type:"Sticker",Points:1});

Office365Outlook.SendEmail("user@domain.com","Subject Text", peoplePicker.Selected.DisplayName & " has just been given an award for " & Values.SelectedText.Value & "Comment: " & Comment.Text);

Reset(Comment);Reset(Values);
,

Notify( "Please ensure you fill in at least the Username and Value fields. Comments are optional.", NotificationType.Error ))
whereswallyx3
Frequent Visitor

@Adrian_Celis 

Talk about not seeing the forest for the trees!!! Thank you - such a simple oversight.

Appreciate the quick response. Working as planned now.

Cheers

 

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,745)