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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Email Form contents
Power Apps
Unanswered

Email Form contents

(1) ShareShare
ReportReport
Posted on by 438
I have created a form which will assign a task to one of the team. When the form is created the task owner is selected from a Combo box linked to the Office365 datasource. The code used for the Items property is 
Choices([@'IMS-ESD-04 Project Snag List - Template'].OwnerID)
 
Once the task has been created I want to send the task owner an email when the "Save" icon is pressed, I am not sure what code I should write in the OnSelect property in order to achieve this .
 
Categories:
I have the same question (0)
  • Suggested answer
    Artur Stepniak Profile Picture
    1,534 Super User 2025 Season 2 on at
    Email Form contents
    Hello,
     
    you'd need to prepare a flow to send an e-mail to the task owner. You do it this way:
    1. Create a flow with instant trigger and choose PowerApps.
    2. Create an input variable which should be an owner's e-mail address.
    3. Use the input variable in Send e-mail action in the flow.
    4. Test if it works correctly. :-)
    5. If yes, then add it to the app and on OnSelect button property - add [FLOW-NAME].Run([OWNER EMAIL ADDRESS]).
     
    Tah dah, done!
     
    In case of any other questions, let me know. If the answer helped you, mark it, so that others can benefit from it.
     
    Best regards,
     
    Artur Stepniak
  • nshaw75 Profile Picture
    438 on at
    Email Form contents
     
    thanks you for your reply.  The form I am creating is going to be a template form for use on various projects, If I create the flow will it associate itself with the template, or will the flow need to be recreated each time the form is used for a new project?
  • Suggested answer
    Artur Stepniak Profile Picture
    1,534 Super User 2025 Season 2 on at
    Email Form contents
    Hello,
     
    the flow is associated with the app and the button. It's not connected to the form itself. If you're going to use a different form in the app, then you'd need to use a different button, thus... you'd need to place Run() action on OnSelect property again.
     
    In case of any other questions, let me know. If the answer helped you, mark it, so that others can benefit from it.
     
    Best regards,
     
    Artur Stepniak
  • Suggested answer
    timl Profile Picture
    36,319 Super User 2025 Season 2 on at
    Email Form contents
    Hi nshaw75 
     
    Instead of calling a Flow, another option would be to send the email directly from Power Apps using the Office365Outlook Connector. 
     
    The first step would be to add the Office365Outlook connector to your app via the Data pane.
    .
    You can then use the following code in the OnSelect property of your "Save" button:
     
    Office365Outlook.SendEmailV2(
        YourTaskOwnerComboBox.Selected.Email, 
        "Email Title - New Task Assigned",
        "Email Body Text ...."
    );
     
  • nshaw75 Profile Picture
    438 on at
    Email Form contents
    Hi @timl
     
    Thanks this is he way I was hoping to be able to carry this out. I have though got a red line under the entire code and the error message reads Office365Outlook.SendEmailV2 failed: The function 'SendEmailV2' has an invalid value for parameter 'To' a blank value was passed where it was not expected. I am not sure if I should have put quotation marks in or not 
     
    Office365Outlook.SendEmailV2(
        DataCardValue20.Selected.Email,
        "Email Title - New Task Assigned",
        "Email Body Text ...."
  • timl Profile Picture
    36,319 Super User 2025 Season 2 on at
    Email Form contents
    It looks like DataCardValue20.Selected.Email isn't returning a valid email.
     
    If you add a label and set theText property to DataCardValue20.Selected.Email, can you inspect the value that's shown? Does it show the email address that's selected in your dropdown?
  • nshaw75 Profile Picture
    438 on at
    Email Form contents
    Hi @timl
     
    I have created the label but there is no value showing. would it be due to the combobox returning the OwnerID and not and email?
  • nshaw75 Profile Picture
    438 on at
    Email Form contents
    This is doing my head in. I really do not understand why it doesn't work 😭
    SubmitForm(Form1_1);
    Office365Outlook.SendEmailV2(
        DataCardValue20.Selected.Email,
        "Email Title - New Task Assigned",
        "Email Body Text ...."
    );
    Navigate('Success Screen');
    ResetForm(Form1_1);
    I have tested the code by a: Changing the DataCardValue20.Selected.Email to a hardcoded email - works as would be expected, and b; I have created a Text Label within the form Text = DataCardValue20.Selected.Email. This returns the selected email address. I have tried adding the code Text(DataCardValue20.Selected.Email) instead, I have tried with 'inverted commas' and "quotation marks". Nothing is working. 
     
    I thought this would be fairly straightforward :(
     
  • Verified answer
    timl Profile Picture
    36,319 Super User 2025 Season 2 on at
    Email Form contents
    Hi nshaw75 
     
    Given that DataCardValue20.Selected.Email works on the label within the form, the most likely cause is that DataCardValue20 is being reset after the call to SubmitForm.
     
    What I suggest is to change the formula on the button to store the email address in a variable like so:
     
    UpdateContext({locSelectedEmail:DataCardValue20.Selected.Email});
    SubmitForm(Form1_1);

    I'd then add the remaining formula to the OnSuccess property of Form1_1 so that the email is sent only if the call to SubmitForm succeeds.
     
     
    Office365Outlook.SendEmailV2(
        locSelectedEmail,
        "Email Title - New Task Assigned",
        "Email Body Text ...."
    );
    Navigate('Success Screen');
    ResetForm(Form1_1);
     
    Hopefully that will work but if it still doesn't pickup the correct email address, you can check the variables panel to see if locSelectedEmail is set correctly.
  • nshaw75 Profile Picture
    438 on at
    Email Form contents
    Fantastic timl Thanks very much. 
     
    I was almost losing it but it has worked. 

    🤩🥳🎉🎉🎊🎊

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 836 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard