web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / when trying to submit ...
Power Apps
Unanswered

when trying to submit data to email it is copying data from the first item rather than filled in data

(0) ShareShare
ReportReport
Posted on by 54

I have the below code and when it is submitted it is set to also email but for some reason the email data is not the data that just got saved but is from a previous form. How do I make it use the data they just put in.

 

 

SubmitForm(EditForm1);

 

If(FormTypeDropdown.Selected.Value = "Form",Office365Outlook.SendEmailV2("email@address.com",
"Form","Name:" & " " & DataCardValue9.Text & "<br>"
& "Job :" & " " & DataCardValue10.Text & "<br>"
& "Date1:" & " " & DataCardValue48.Text & "<br>"
& "Date2:" & " " & DataCardValue47.Text & "<br>"
& "Work:" & " " & DataCardValue15.Selected.Value & "<br>"

Categories:
  • slima1 Profile Picture
    69 on at

    See if this helps

     

    SubmitForm(EditForm1);
    
    If(EditForm1.Valid, // Check if the form submission is valid
     Office365Outlook.SendEmailV2("email@address.com",
     "Form",
     "Name: " & DataCardValue9.Text & "<br>" &
     "Job: " & DataCardValue10.Text & "<br>" &
     "Date1: " & DataCardValue48.Text & "<br>" &
     "Date2: " & DataCardValue47.Text & "<br>" &
     "Work: " & DataCardValue15.Selected.Value & "<br>"
     );
     ResetForm(EditForm1); // Optionally reset the form after successful submission
    );

     

  • jdrm1 Profile Picture
    54 on at

    it needs to check the drop down which is why i have it there

  • slima1 Profile Picture
    69 on at

    forgiveness

    try

    Patch(
    YourDataSource, // Replace YourDataSource with the actual name of your data source
    Defaults(YourDataSource),
    {
    Name: DataCardValue9.Text,
    Job: DataCardValue10.Text,
    Date1: DataCardValue48.Text,
    Date2: DataCardValue47.Text,
    Work: DataCardValue15.Selected.Value
    }
    );

    If(FormTypeDropdown.Selected.Value = "Form",
    Office365Outlook.SendEmailV2(
    "email@address.com",
    "Form",
    "Name: " & DataCardValue9.Text & "<br>" &
    "Job: " & DataCardValue10.Text & "<br>" &
    "Date1: " & DataCardValue48.Text & "<br>" &
    "Date2: " & DataCardValue47.Text & "<br>" &
    "Work: " & DataCardValue15.Selected.Value & "<br>"
    )
    );

  • timl Profile Picture
    37,287 Super User 2026 Season 2 on at

    Hi @jdrm1 

    After a call to SubmitForm, the form will reset which is why you're not seeing the data that just got saved. The answer is to reference the LastSubmit property instead.

     

    If you haven't done so, you'd want to add this formula to the OnSuccess property of the EditForm1 so that it sends the email only when the record is saved successfully.

     

     

    If(
     FormTypeDropdown.Selected.Value = "Form",
     Office365Outlook.SendEmailV2(
     "email@address.com",
     "Form",
     "Name: " & EditForm1.LastSubmit.Name & "<br>" &
     "Job: " & EditForm1.LastSubmit.Job & "<br>" &
     "Date1: " & EditForm1.LastSubmit.Date1 & "<br>" &
     "Date2: " & EditForm1.LastSubmit.Date2 & "<br>" &
     "Work: " & EditForm1.LastSubmit.Work & "<br>"
     )
    );

     

     

     

  • jdrm1 Profile Picture
    54 on at

    that still gives the same result when using last submit

  • timl Profile Picture
    37,287 Super User 2026 Season 2 on at

    @jdrm1 

    LastSubmit will definitely return the last record that was saved. The only thing I can suggest is to save the values prior to calling SubmitForm.

     

    UpdateContext({locBody:
     "Name: " & DataCardValue9.Text & "<br>" &
     "Job: " & DataCardValue10.Text & "<br>" &
     "Date1: " & DataCardValue48.Text & "<br>" &
     "Date2: " & DataCardValue47.Text & "<br>" &
     "Work: " & DataCardValue15.Selected.Value & "<br>"}
    );
    
    SubmitForm(EditForm1);
    
    If(
     FormTypeDropdown.Selected.Value = "Form",
     Office365Outlook.SendEmailV2(
     "email@address.com",
     "Form",
     locBody
     )
    );

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard