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

SendEmail sending past/unchanged data

I have a simple, standard form with 3 fields. I'm using Office365.SendEmail to email the form data to a recipient. I have a general question and trouble question:


General Question: I want the email to go to the logged in user. I know how to do this with the Office365 Users connection, but is there a way to pull the logged in user/account/email from the Office365 Email Connector? (This is just to avoid adding overhead and potential data leaks with the User connector.)

 

Trouble Question. My syntax is below. Everything works well the first time, but the subsequent messages only send data from the first submittal (even though I reset the form and the fields are clear on subsequent submittals). 
Example: On first attempt, I send John Doe for the name and it works. On all subequent attempts, I can send Jane Doe, but it continues with John Doe. It's the same for all 3 fields.

My code:
Office365.SendEmail("user@mail.com", "SubjectText", "Name: "&Name_DataCard2.Default& Char(13) & "Email: "&Email_DataCard2.Default& Char(13) & "Phone: "&Phone_DataCard2.Default) 

I assume the issue is with the .Default, but I tried .text, .value, etc., with no luck. Something obvious I'm sure; any ideas?

1 REPLY 1
Super User
Super User

Re: SendEmail sending past/unchanged data

Hi @AW 

 

You can get the current logged in user details through User().Email, this will return the email of current logged in user.
 
While to send the email with latest data, can you try to modify your formula as:
 
If you are submitting the edit form before sending the email:
Office365.SendEmail(User().Email, "SubjectText", "Name: "&Form1.LastSubmit.Name& Char(13) & "Email: "&Form1.LastSubmit.Email& Char(13) & "Phone: "&Form1.LastSubmit.Phone
 
If the form is not submitted first and you just want to send the email with entered values:
Office365.SendEmail(User().Email, "SubjectText", "Name: "&Form1.Updates.Name& Char(13) & "Email: "&Form1.Updates.Email& Char(13) & "Phone: "&Form1.Updates.Phone
 
Here, Form1 is the name of edit form.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

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!

Users Online
Currently online: 53 members 4,308 guests
Please welcome our newest community members: