Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Using a button to send an email with formatting.

Posted on by 223

Hello,

 

I have been working with PowerApps for all most a month and I'm almost done with it. most of the time when I run into issues I've found the solution on this site. Anyways I have a screen in my app for reporting Maintenance issues with our etchers. I have a button that pulls the data from individual TextInputs and Dropdowns (I don't have them on a Card) and puts them in a excel sheet on OneDrive. Then it navigates to a Success Screen and Emails the data to a group of people.

 

Everything works in my formula the issue that I'm having is that the body of the email comes out as one line. I have been checking the site and cant find anything that doesn't use Cards or HTML. Is there a simple way to just add some spacing to my formula so that each item will be on its own line? ALso im not getting EtcherList_Dropdown, Common_Errors_Dropdown, or the Maintenance notes in the email. 

 

 

 

Patch(
 Etching_Maintenance_Reports,
 Defaults(Etching_Maintenance_Reports),
 {
 'Tech ID': 'ID#_TextInput'.Text,
 'Tech Name': Tech_Name_TextInput.Text,
 Date: Enter_New_Task_DatePicker.SelectedDate,
 'Etcher/Extractor': EtcherList_Maintenance_Dropdown.Selected.Value,
 'Common Errors': Common_Errors_Dropdown.Selected.Value,
 'Troubleshooting Notes': Maintenance_Notes_TextInput.Text
 }
);
Reset(EtcherList_Maintenance_Dropdown);
Reset(Common_Errors_Dropdown);
Reset(Maintenance_Notes_TextInput);
Reset(Trouble_Shooting_Steps_Checkbox);
Navigate(
 SuccessScreen,
 Fade
);Office365Outlook.SendEmail(
 "EmailAdrress1@Email.com,EmailAddress2@Email.com",
 "Etcher Down",
 "One of the Etcher has gone down. Details to Follow." & Enter_New_Task_DatePicker.SelectedDate & Tech_Name_TextInput.Text & 'ID#_TextInput'.Text & EtcherList_Maintenance_Dropdown.Selected.Value & Common_Errors_Dropdown.Selected.Value & Maintenance_Notes_TextInput.Text
)

 

 

These are the values I entered into the fields followed by the body of the email I got. 

date

name

id

Etcher 1

bad Etch

this is the maintenance notes

 

Body of the email looks like this:

One of the Etcher has gone down. Details to Follow.1/14/2021NameID

 

Thanks for any help!

Categories:
  • Verified answer
    Chrisguff12 Profile Picture
    Chrisguff12 223 on at
    Re: Using a button to send an email with formatting.

    Thanks for the list I'm sure it will help with future projects. 

     

    For issue I figured it out the email issues. My formula that I originally posted I had three parts. 1st was to write data to one drive, 2nd was to reset fields, and 3rd was to send email. So I was erasing the fields before I was sending the email.  I moved the email string above the reset String and everything works. 

     

    Thanks for all your help. 

  • v-jefferni Profile Picture
    v-jefferni on at
    Re: Using a button to send an email with formatting.

    Hi @Chrisguff12 ,

     

    For you first question, Char(10) is ASCII code 10 which means a New Line. Below is ASCII code table for your reference:

    91.gif

    So you could see Char(9) is TAB.

     

    For the second question, without detailed formula and layouts in your app, it's difficult to figure out the source of that issue. You could use a new added button to achieve the need first, and if you like, you could post another thread to describe the problem with details.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Chrisguff12 Profile Picture
    Chrisguff12 223 on at
    Re: Using a button to send an email with formatting.

    Wow. that was an easy fix. Thanks

     

    But like most of these request I have a few follow ups.

    first, I am assuming that the Char(10) represents the Enter key. do you have a list or a link to other characters that I may need like Tab...etc?

     

    Second, I was able to use the Char(10) to break up the email body. But some of the data is not showing up. it shows everything up to the ID and there are spaces under it but they are blank. I believe that I have all the fields and values right because when I check my Excel doc in OneDrive all the data is there in the right fields. any ideas why the data would show up in OneDrive but not in the email?

     

    Here's what the Email looks like now.

    Chrisguff12_0-1610742875523.png

     

    Update: SO I am testing the Email Formula. So I made a new button and just used the Email Formula and I got all the data in the email. then when I copy the same code to the original button it will not show the last three fields in the email. 

     

     

  • Verified answer
    v-jefferni Profile Picture
    v-jefferni on at
    Re: Using a button to send an email with formatting.

    Hi @Chrisguff12 ,

     

    Would you like to wrap the Email body with formula on the button?

     

    If so, you could add &Char(10)& into the body of send email action:

    Office365Outlook.SendEmail(
     "EmailAdrress1@Email.com,EmailAddress2@Email.com",
     "Etcher Down",
     "One of the Etcher has gone down. Details to Follow." &Char(10)& Enter_New_Task_DatePicker.SelectedDate &Char(10)& Tech_Name_TextInput.Text &Char(10)& 'ID#_TextInput'.Text &Char(10)& EtcherList_Maintenance_Dropdown.Selected.Value &Char(10)& Common_Errors_Dropdown.Selected.Value &Char(10)& Maintenance_Notes_TextInput.Text
    
    )

    95.png

    MicrosoftTeams-image (1).png

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard