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 / Sending Values From an...
Power Apps
Answered

Sending Values From an Edit/View form via an email message

(0) ShareShare
ReportReport
Posted on by 99

Greetings,

 

I created an app that pulls SharePoint item information and displays it in a form (based on a drop-down selection process), including an email address which is part of the item record.,  The data is displayed on a form on the app screen.  I want to put a "notification" button on the form so that when it is pressed, an email will generate displaying the values of the form and send the data to the user who's email address is in the item record.  I've tried, with no success, building a Flow for the operation.  I've tried other suggestions from forums which creates a solution directly in Power Apps, but with no luck.  Does anyone have any suggestions on how I can accomplish this?  Thanks so much.  

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ShadyCheech 

    Without knowing the specifics of your app and data and form, then general process would be this based on what you have said:

     

    On your screen (doesn't need to be in the form) you would have a toggle or checkbox control to indicate you want to generate the email.

     

    Your submit for the form would be SubmitForm(yourFormNameHere) only.

     

    In the OnSuccess action of your form, you would have a formula similar to the following:

    If(theCheckBox.Value,
     With(Self.LastSubmit,
     Office365Outlook.SendEmailV2(fieldWithRecipientNameFromFormRecord,
     "Title",
     $"{fieldFromFormThatYouWant}
     {anotherFieldFromFormThatYouWant} 
     etc...
     "
     )
     )
    )
    

     

    I hope this is helpful for you.

  • ShadyCheech Profile Picture
    99 on at

    Hi @RandyHayes ,

     

    Thank you for your help.  I'm getting a notification that reads "Office365Outlook.SendEmailV2 failed: {"status":400, "message";"One or more recipients are invalid..."

     

    I added a checkbox and placed the code in the "OnSuccess" formula bar of the form.  My code looks like this:

     

    If(Checkbox2.Value,
     With(Self.LastSubmit,
     Office365Outlook.SendEmailV2(DataCardValue2_4.Text,
     "Title",
     $"{DataCardValue60.Text}
     {DataCardValue5_4.Text}
     "
     )
     )
    )

    I receive the error message after I click the submit button.  

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ShadyCheech 

    Do NOT reference the DataCardValueX controls!  After the form is submitted, there is no guarantee that they contain what you want.

    As in the formula I provided, reference the column names in your formula.

    This is all in a With scoped statement using LastSubmit as the With record.  That means any column you have in your record can be referenced.

    For example, if your record submitted has a Title column, email and a Name column, then your formula can just reference them to be accurate.

    If(theCheckBox.Value,
     With(Self.LastSubmit,
     Office365Outlook.SendEmailV2(email,
     "Subject",
     $"{Title}
     {Name} 
     etc...
     "
     )
     )
    )

     

     

  • ShadyCheech Profile Picture
    99 on at

    Thanks for your help.  I was expecting the form to generate the email directly from the values of the form and not from the SharePoint list items, thus the reason I referenced the DataCard values directly.  I'm fairly new to Power Apps (but not programming), so that will be my excuse.  😁  

     

    I replaced the DataCard references to include the name the of the list columns, but it still did not work.  I will need to spill over this during the weekend and try it again on Monday when I get back to work.  Thanks again for all your help.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ShadyCheech 

    So first - no worries about not programming as PowerApps is a no-code platform.  You are just writing a formula for PowerApps to evaluate.

     

    Now, as for the form.  *Normally* your datacards in your form are there to represent a field in your list.  And, the DataCardValuex controls are the input controls that establish the values that are going to be submitted when you submit the form.

     

    So, if you have a Title column (for example), then you would have a field in your form for Title.  That would be represented with a DataCard in the form.  That DataCard would have (by default) a DataCardValuex control.  In this case it would be a TextInput control. 

    That's all fine, but the moral of the "Form Story" is that after you submit the form, whatever was put in the TextInput control is what will be submitted to the Title column of your list.

    THAT is all in your LastSubmit record!!

     

    Let's dig deeper into what you are doing...Let's build this up from the base so you can get used to what is going on.

     

    FIRST.  Change your OnSuccess action formula to:

    If(Checkbox2.Value,
     With(Self.LastSubmit,
     Office365Outlook.SendEmailV2("<putYourEmailAddressHere>",
     "Subject",
     "Message"
     )
     )
    )

    When you submit your Form, you should then receive an email with a Subject subject and a Message message.

    Did you get an email?

     

    NEXT.  Change your OnSuccess action formula to:

    If(Chgeckbox2.Value,
     With(Self.LastSubmit,
     Office365Outlook.SendEmailV2(<emailColumnHere>,
     "Subject",
     "Message"
     )
     )
    )

    In the above, first look at your DataCardValue2_4 control...what datacard is that in the form?  And, most important, what is the Field for that datacard?  THAT is what you would put in the <emailColumnHere> above.

    Put that column name in and submit.

    Did an email send?

     

    Let's start with that basic bit first.

  • ShadyCheech Profile Picture
    99 on at

    I entered my email address in the formula as you listed in the first block, and no, I did not receive an email.  In fact, it says there is an error in the formula, but when I extend the window to find it, there are no red lines or anything indicating where the error is.  To double check, I confirmed the following:

    • The syntax is exactly as you had written in the example.
    • The formula is in the OnSelect action of the correct form.
    • There is a checkbox by the correct name on the screen.
    • The submit button does have the correct submit formula in the action window.

    I don't expect you to spend a lot of time on this as I know you have many users you need to help in this forum.  Your help is much appreciated though.  I expected Power Apps and Power Automate to be easier to deal with than InfoPath and SharePoint Designer, but I'm finding this not to be true at all. 🙄 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ShadyCheech 

    Keep at it - you will find that PowerApps is far superior to working with InfoPath!!

     

    So if the first suggestion did not work, then we are narrowing it down.

    Next to troubleshoot: Place a button on your screen and set the OnSelect action formula to:

    Office365Outlook.SendEmailV2("<putYourEmailAddressHere>",
     "Subject",
     "Message"
    )

    Does this work when you try it?

  • ShadyCheech Profile Picture
    99 on at

    Making some progress here...yes, that did work.  I then copied the formula over to the OnSuccess action of the form and it worked as well there (as it should).  Now, I am trying to get the column names into the subject and body of the formula, but am having no luck without errors.  

     

    This post reminds me of the movie "What About Bob".  Baby steps, baby steps...lol!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ShadyCheech 

    Yes, baby steps for sure.

     

    So, what I don't understand though is that you initially said that the first formula (for the OnSuccess) did not work. This new step of troubleshooting essentially just put that same formula on a button to test.

    The only difference was the Checkbox checking.  

    So, let's focus on that.  Your formula in the OnSuccess should now be:

    If(Checkbox2.Value,
     With(Self.LastSubmit,
     Office365Outlook.SendEmailV2("<putYourEmailAddressHere>",
     "Subject",
     "Message"
     )
     )
    )

    Before you stated that this did nothing.  But now this is working??

     

    If so, then let's move on.

    Try something simple.  Pick any column from your form record.  I'm going to guess that it has a Title column (if not, pick another text column).

    So, change the formula to the following:

    If(Checkbox2.Value,
     With(Self.LastSubmit,
     Office365Outlook.SendEmailV2("<putYourEmailAddressHere>",
     Title,
     Title
     )
     )
    )

     

    That should provide you an email with the Subject filled in with the record title and the message the same.

     

    What do you get?

  • ShadyCheech Profile Picture
    99 on at

    No, what worked was using this formula on a button as you asked me to try:  

    Office365Outlook.SendEmailV2("<putYourEmailAddressHere>",
     "Subject",
     "Message"
    )

     

    When I try the following formula, I get error messages:

     

    If(Checkbox2.Value,
     With(Self.LastSubmit,
     Office365Outlook.SendEmailV2("<putYourEmailAddressHere>",
     Title,
     Title
     )
     )
    )

     

    I've tried the checkbox argument with no avail.  I experimented using the submit button (Button_Submit3_3.Pressed) in the formula to initiate the action, but that doesn't work either (maybe it's not supposed to).

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
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard