cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jachord
Regular Visitor

Need help with Launch (Mailto:

 

I am having an issue with Powerapps.  I need to send an email with out outlook 365.  So I am using the Launch fuction which works fine if put a hard email in the code but does not work if I try to use a variable from a field.  As you can see it does not like the ThisItem.Email value.  I can make it use just "Email" but then I get giberish in my To:field in outlook.  The email data is Generated by a default value of Text(user().email).  Yes I am trying to get the app to email the information in the form back to the person that just created the record.  We have to copy the information into a program that is not compatable with powerapps or have a phone app capability.  I have quite a bit of experiance in ACCESS but this is new to me so any help would be great.  

 

 

powerapp.PNG

10 REPLIES 10
timl
Super User
Super User

Hi @Jachord

 

What's the error message that you see when you hover your mouse over the underlined value ThisItem.Email?

 

ThisItem is valid only in the context of a form or card. I suspect that you've added this formula to a button or control that is not within a card, and this is the reason why you see this error.

Jachord
Regular Visitor

Well that explains it.  I have that added to the submit button in the action bar at the top of the screen.  I don't guess there is anyway to make this work?  I was trying to keep it simple with only one button doing two functions.

Ok put a button in the form and fixed that problem.  Now is there a way to put line break in the body between each thisitem value?

With regard to placing the button in the header, if you want to add the button in a display form, you can reference the data item that your form is set to. The syntax would be something like this:

 

BrowseGallery1.Selected.Email

What exactly do you mean by put a line break in the body between each thisitem value? Do you want to place line breaks in your formula, or do you want to place line breaks in the text that you're constructing for the body argument of your call to mailto? If it's the former, <shift><enter> will add a line break to the formula. For the latter, here's the formula for the escape sequence that gives you a carriage return/line feed.

 

Char(13) & Char(10)
Jachord
Regular Visitor

Here is what I have.  Remember I am using an exchange server so have to use launch (mailto: with the below code.  What I need is line break between each field.  Everything is working but it is coming out as one long string instead of how it is displayed in the code.  The other issue I have to address is that ios and android are both dumping all of the information in the TO: field in the emails.

 

Launch("mailto:"& ThisItem.Creator_x0020_Email & "&subject=Recent site visit report.&body="
&" Date: "& ThisItem.Date
&" Customer: " & ThisItem.Customer_x0020_Name 
&" Purpose of visit: "& ThisItem.Purpose_x0020_of_x0020_Visit
&" Issues: "& ThisItem.Issues
&" Notes: "& ThisItem.Notes)

For Exchange/Outlook, you can use the URL escape sequence for a line break - %0A

 

Launch("mailto:"& ThisItem.Creator_x0020_Email & "
&subject=Recent site visit report.&body="
&" Date: "& ThisItem.Date & "%0A" &
&" Customer: " & ThisItem.Customer_x0020_Name & "%0A" & 
&" Purpose of visit: "& ThisItem.Purpose_x0020_of_x0020_Visit  & "%0A" &
&" Issues: "& ThisItem.Issues & "%0A" &
&" Notes: "& ThisItem.Notes)

I don't know what the answer is to IOS/Android not separating the Subject and Body values. Hopefully, someone else here will know the answer.

Jachord
Regular Visitor

Well that worked for the line breaks but the other issue is happening now in outlook as well so i must have made a mistake in the code.

 Ok I changed the & in front of subject to ? and now it populates correctly but puts a + in place of spaces.  

I'd try substituting the spaces in your data items with the escape code for a space,  %20

 

I'd use this syntax that looks like this in all the places that could contain spaces....

 

&" Customer: " & 
Substitute(ThisItem.Customer_x0020_Name," ", "%20") & "%0A" &

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,419)