cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gpence
Level: Powered On

Email form data (without using Flows) - Form data not showing in my email...?

Hi All,

 

I've writen a couple of small apps, but I'm still pretty new to PowerApps. I have a multi-screen app. The main screen uses a gallery to display an index of Price Alerts. The user then selects one of the items and goes to a Details page in View mode. The user can edit that entry (which switches the same screen to Edit Mode). There is also a NewItem screen for creating new entries. 

 

When the user is on the Details page in view mode, one of my menu options (an icon) is to email the data to one or more users. This screen uses the Email Screen from the New Screen drop down list. It contains the predefined To: Subject: and Message: fields and I added a form which includes the data from the current record as shown in the photo below. The red box shows the default fields and the pink arrow points to my (added) form data.

 

My data shows on the screen, but not in the email. Why? I thought maybe it needed to be inside another container, but the form is on the same level as Message, Subject, etc.

 

@LRVinNC  @Shanescows @v-monli-msft  Do any of you have a suggestion? I'm trying to get this app to work for a demo tomorrow morning and this is the only thing holding me up...

 

Thanks,

gpence

 

PowerApps-Send-Email-with-Record-Info.png

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Email form data (without using Flows) - Form data not showing in my email...?

@gpence  Can you post the code attached to your send button?  For the generic email page it looks like this:

Capture.PNG

My suspision is that this did not get modified to include the addition fields at the bottom of your screen.  SendEmail looks for 3 primary fields:  recipients, subjects and body.  In the example above, we are sending TextEmailMessage1.Text which would be the contents of the message box on your form.  If you haven't modified this, you will need to concatenate to this text the additional information you want to print.  In order to format it below the other information you will probably need to use some simple HTML.  You can do that easily by adding a global variable containing the text you want to become the body of your email.  Here I am bulding up my report body from a gallery, but you can do the same with the data from your screen.  Once I have built the entire body in the HTMLText global variable, then I call the email routine (I'm using V2, but you can use the one you are currently using.)

Set(StartDate,DateAdd(dpWeekEndDate.SelectedDate,-7));
If(CountRows(galLMV_1.AllItems) <> 0,
Set(
    HTMLEmail,
    "<b><font size = 5>Accomplishments and Next Week for " & ddANSDept.Selected.Title & " (" & LookUp(
        Department,
        Title = ddANSDept.Selected.Title
    ).LTOwner.DisplayName & ") for week ended " & dpWeekEndDate.SelectedDate & "</b></font>" & 
    Concat(
        galLMV_1.AllItems,
        If(!IsBlank(galLMVProject_1),"<b><font size=4><br><br>" & galLMVProject_1 & "</font></b><br>", "") & 
        If(
            butLMVMS_1.Text = "Accomplishments", "<b><u>" & butLMVMS_1.Text & "</b></u>",
            butLMVMS_1.Text = "Next Week",      "<br><b><u>" & butLMVMS_1.Text & "</b></u>",
            IsBlank(butLMVMS_1.Text),"",         "&nbsp;&nbsp;&nbsp;<li>" & butLMVMS_1.Text & "</li>"
        )
    )
);
Office365.SendEmailV2(
    tiANSEmail,
    "Accomplishments and Next Week Report",
    HTMLEmail,
    {Importance: Normal}
);

I hope this helps.  


View solution in original post

5 REPLIES 5
Super User
Super User

Re: Email form data (without using Flows) - Form data not showing in my email...?

@gpence  Can you post the code attached to your send button?  For the generic email page it looks like this:

Capture.PNG

My suspision is that this did not get modified to include the addition fields at the bottom of your screen.  SendEmail looks for 3 primary fields:  recipients, subjects and body.  In the example above, we are sending TextEmailMessage1.Text which would be the contents of the message box on your form.  If you haven't modified this, you will need to concatenate to this text the additional information you want to print.  In order to format it below the other information you will probably need to use some simple HTML.  You can do that easily by adding a global variable containing the text you want to become the body of your email.  Here I am bulding up my report body from a gallery, but you can do the same with the data from your screen.  Once I have built the entire body in the HTMLText global variable, then I call the email routine (I'm using V2, but you can use the one you are currently using.)

Set(StartDate,DateAdd(dpWeekEndDate.SelectedDate,-7));
If(CountRows(galLMV_1.AllItems) <> 0,
Set(
    HTMLEmail,
    "<b><font size = 5>Accomplishments and Next Week for " & ddANSDept.Selected.Title & " (" & LookUp(
        Department,
        Title = ddANSDept.Selected.Title
    ).LTOwner.DisplayName & ") for week ended " & dpWeekEndDate.SelectedDate & "</b></font>" & 
    Concat(
        galLMV_1.AllItems,
        If(!IsBlank(galLMVProject_1),"<b><font size=4><br><br>" & galLMVProject_1 & "</font></b><br>", "") & 
        If(
            butLMVMS_1.Text = "Accomplishments", "<b><u>" & butLMVMS_1.Text & "</b></u>",
            butLMVMS_1.Text = "Next Week",      "<br><b><u>" & butLMVMS_1.Text & "</b></u>",
            IsBlank(butLMVMS_1.Text),"",         "&nbsp;&nbsp;&nbsp;<li>" & butLMVMS_1.Text & "</li>"
        )
    )
);
Office365.SendEmailV2(
    tiANSEmail,
    "Accomplishments and Next Week Report",
    HTMLEmail,
    {Importance: Normal}
);

I hope this helps.  


View solution in original post

gpence
Level: Powered On

Re: Email form data (without using Flows) - Form data not showing in my email...?

@LRVinNC 

 

Yes, I think you hit the nail on the head. My current action on the Send icon is this:

 

/*Create semicolon separated list of people to email, send the email, reset subject & message fields*/           
Set(_emailRecipientString, Concat(MyPeople, Mail & ";"));           
Office365.SendEmail(_emailRecipientString, TextEmailSubject1.Text, TextEmailMessage1.Text, {Importance:"High"});           
Reset(TextEmailSubject1);           
Reset(TextEmailMessage1);           
Clear(MyPeople);Navigate(HomeScreen,ScreenTransition.None)

I understand your example of setting a new variable for the body of the text. Can I send all of the form data at once by calling Form1, or must I explicitly include each field in the form?

 

Thanks for your comment. I'll play around a bit now...

gpence

Super User
Super User

Re: Email form data (without using Flows) - Form data not showing in my email...?

No, you will need to reference each field individually and you'll need to include your labels, spacing and line breaks.  Think of it as building a big long string that will map out how the page looks.  If you don't tell it to print/space/carriage return, it won't.  

gpence
Level: Powered On

Re: Email form data (without using Flows) - Form data not showing in my email...?

Thanks, @LRVinNC  I was afraid of that... actually, it's not too bad. Reminds me of the old days of hand coding spacing in HTML. Thanks again for all of your help. It is GREATLY appreciated!!

 

For anyone else who faces the same issue, here is what my OnSelect code now looks like on the Send icon -- my variable is called AlertData and I built out the variable to include the TextEmailMessage1.Text and then add my Form1 data as well. (Note; Char(10) is the LineFeed code)

 

/*Create semicolon separated list of people to email, send the email, reset subject & message fields*/           
Set(_emailRecipientString, Concat(MyPeople, Mail & ";")); 
Set(   
   AlertData,
TextEmailMessage1.Text & 
Char(10) & Char(10) &
"PRICE INCREASE ALERT DATA: " & Char(10) &
"========================================= " & 
Char(10) & Char(10) &
DataCardKey61 & ":    " & DataCardValue61 &Char(10) & 
DataCardKey62 & ":    " & DataCardValue62 &Char(10) &
DataCardKey63 & ":    " & DataCardValue63 &Char(10) &
DataCardKey44 & ":    " & DataCardValue44 &Char(10) &
DataCardKey45 & ":    " & DataCardValue45 &Char(10) &
DataCardKey46 & ":    " & DataCardValue46 &Char(10) &
DataCardKey47 &":    " &  DataCardValue47 &Char(10) &
DataCardKey48 &":    " &  DataCardValue48 &Char(10) &
DataCardKey49 & ":    " & DataCardValue49 &Char(10) &
DataCardKey50 &":    " &  DataCardValue50 &Char(10) &
DataCardKey51 & ":    " & DataCardValue51 &Char(10) &
DataCardKey52 & ":    " & DataCardValue52 &Char(10) &
DataCardKey53 & ":    " & DataCardValue53 &Char(10) &
DataCardKey54 & ":    " & DataCardValue54 &Char(10) &
DataCardKey55 & ":    " & DataCardValue55 &Char(10) &
DataCardKey56 & ":    " & DataCardValue56 &Char(10) &
DataCardKey57 & ":    " & DataCardValue57 &Char(10) &
Char(10) &
"========================================= " & Char(10) &
Char(10)
      );
Office365.SendEmail(_emailRecipientString, TextEmailSubject1.Text, AlertData, {Importance:"High"});           
Reset(TextEmailSubject1);           
Reset(TextEmailMessage1);    
Clear(MyPeople);Navigate(HomeScreen,ScreenTransition.None)

Thanks,

gpence

gpence
Level: Powered On

Re: Email form data (without using Flows) - Form data not showing in my email...?

EDIT: STARTING A NEW THREAD 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,339)