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 / Send Email on submit
Power Apps
Answered

Send Email on submit

(0) ShareShare
ReportReport
Posted on by 57

Hi all,

 

I have been looking for solutions here on the forum and on YouTube for the following issue, but unable to find this. I hope you all can help me(probably it is something very simple that I overlook). Basically, I have a form based out of columns in SharePoint, some of it are text, some choices and there is a date field. What I would like is on when submitted the form the results are automatically e-mailed to a certain group of people, this part is working.

 

Is this possible to do? as currently I am unable to include the results, hope you could advice me on the best approach.

 

Currently I have this:

SubmitForm(EditForm8);Navigate(Home);Office365Outlook.SendEmailV2("toemail@xx.xx"," Shift Report","This is the Shift Report: ",{From:"frommail@xx.xx"})

 

Sebastiaan1_0-1672767631703.png 

 

Sebastiaan1_1-1672767925111.png

 

 

 

 

Categories:
  • Anchov Profile Picture
    1,986 on at

    First, I would remove the following code form your Submit Button > OnSelect property:

     

    Navigate(Home);Office365Outlook.SendEmailV2("toemail@xx.xx"," Shift Report","This is the Shift Report: ",{From:"frommail@xx.xx"})

     

     

    Then, on you EditForm8 > OnSucess, Add the following code.  If you want to refence items from your last submit you would want use varLastRecord.Title (or whatever field you want to reference)

     

    Set(varLastRecord, EditForm8.LastSubmit);
    Office365Outlook.SendEmailV2("toemail@xx.xx"," Shift Report",$"This is the Shift Report: {varLastRecored.Title}");
    Navigate(Home);

     

     

    Please note, that the email will sent from the logged in user's Office365 outlook online account.

     

    Reference: https://youtu.be/vpYkOccwn4Y (Shane Young)

     


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers!
    Rick Hurt

  • Sebastiaan1 Profile Picture
    57 on at

    Thank you very much! Just reviewed the video and used your code, but the e-mail only arrives with the following text and not with the data entered? Probably, I do something wrong.

    Sebastiaan1_1-1672771097634.png

     

    As soon as I try to open another form to fill-in the data, it gives me the following response for minutes without any changes. Any idea how to solve this?

    Sebastiaan1_0-1672771057075.png

     

     

  • Sebastiaan1 Profile Picture
    57 on at

    *Double post*

  • Anchov Profile Picture
    1,986 on at

    Please reply with the code you entered for:
    EditForm8 > OnSuccess

    Also, you can comment out Navigate('Home') for now, until you get your email working. 

    //This is a comment.
    //Navigate(Home);

     

  • Sebastiaan1 Profile Picture
    57 on at

    EditForm8 OnSuccess

    Set(varLastRecord, EditForm8.LastSubmit);
    Office365Outlook.SendEmailV2("email@xx.xx","Shift Report", $"This is the Shift Report: {varLastRecord.Title}");Navigate(Home);

    Sebastiaan1_1-1672771933577.png

     

    OnSelect

    SubmitForm(EditForm8)

    Sebastiaan1_0-1672771851385.png

     

  • Anchov Profile Picture
    1,986 on at

    Does the column Title exist in your data source? Is there data in the Title column? If not, choose another column that has data in it. For example, varLastRecord.Airport.Value

     

    Hint: You can check the value of your variables by highlighting it in your code editor after clicking on your Submit button.

    Anchov_0-1672772473647.png

     

  • Sebastiaan1 Profile Picture
    57 on at

    No Title does not exist, that is my error indeed. Lets say I use another column it does not give me the option to check the value of the variables. 

     

    OnSucces:

    Set(varLastRecord, EditForm8.LastSubmit);
    Office365Outlook.SendEmailV2("email@xx.xx","Shift Report UK & Ireland", $"This is the Shift Report: {varLastRecord.Airport.}")

     

    OnSelect

    SubmitForm(EditForm8);
    Set(varLastRecord,EditForm8.LastSubmit);
    EditForm(EditForm8)

     

    Sebastiaan1_0-1672774119959.png

     

     

  • Anchov Profile Picture
    1,986 on at

    Try this, Remove these lines from your OnSelect (they will collide with the one in your OnSuccess):

    SubmitForm(EditForm8);
    Set(varLastRecord,EditForm8.LastSubmit);
    EditForm(EditForm8)

     

    Add this line to your OnSuccess:

    Set(varLastRecord, EditForm8.LastSubmit);
    Office365Outlook.SendEmailV2("email@xx.xx","Shift Report UK & Ireland", $"This is the Shift Report: {varLastRecord.Airport.Value}");

    EditForm(EditForm8)

  • Sebastiaan1 Profile Picture
    57 on at

    Unfortunately, seems not to be working.

    Current line as following: 

    Set(varLastRecord, EditForm8.LastSubmit);
    Office365Outlook.SendEmailV2("email@xx.xx","Shift Report UK & Ireland", $"This is the Shift Report: {varLastRecord.Airport.Value}");
    EditForm(EditForm8)

     

    Sebastiaan1_1-1672778098320.png

     

    The Airport value in sharepoint is a dropdown/choice function, not sure if this is related on why it is not working?

     

  • Anchov Profile Picture
    1,986 on at

    I don't know your data structure of the Airport column, just choose any column that is a single line of text.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard