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

Exporting Gallery from PowerApps

I am currently building an App, and have come across an issue that a lot of people seem to be asking, in one way or another, but not a lot of clear answers and being returned.

 

My app is quite basic, It list all of the services we offer, prices, and has discount % and grand totals etc.

 

I have achieved this by importing data from a spreadsheet, and adding them to a collection when selected.

Once in the collection, they can be seen on the TotalScreen, by displaying the collection in a Gallery. I have then added a few formulas to adjust quantity, and any discounts etc.

 

I now have my TotalScreen, with Its gallery displaying:

 

Service;

Intial Charge;

Monthly Charge;

Quantity;

Initial Discount;

Monthly Discount;

Total Upfront Cost;

Total Monthly Cost

 

for every service selected.

 

Outside of this Gallery, I have another couple of Text Boxs, calculating the grand total of all services selected within my gallery.

 

The idea now is to email this off to myself so it basically creates a quote.

 

The button OnSelect function I have tried is:

Office365.SendEmail(User().Email, "This is the Subject", {Body}

In the {Body} I have tried a wide range of ideas, Gallery3.AllItems yada yada yada...

 

None of which seem to work

 

I have tried Microsoft Flows aswell, but all ideas return with the error, "Invalid argument type. Expecting a text value instead"

 

If anyone knows how to send this gallery in an email, please help!


Regards

Jordan

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Exporting Gallery from PowerApps

You need to create a string (text) with the message that you want displayed in the gallery. You can use the Concat function to do that. For example, the code below will send an e-mail with a formatted table with the items from the gallery:

Office365.SendEmail(
    "my-email@domain.com",
    "Forum post",
    "<p><b>Quote</b></p>" &
        "<table border='1'>" &
            "<tr>" &
                "<th>Service</th>" &
                "<th>Initial Charge</th>" &
                "<th>Quantity</th>" &
                "<th>Initial Discount</th>" &
                "<th>Total Upfront Cost</th>" &
            "</tr>" &
    Concat(
        Gallery1.AllItems,
        "<tr>" &
            "<td>" & Service & "</td>" &
            "<td>" & InitialCharge & "</td>" &
            "<td>" & Quantity & "</td>" &
            "<td>" & InitialDiscount & "</td>" &
            "<td>" & TotalUpfrontCost & "</td>" &
            "</tr>",
        Char(13)) &
    "</table>",
    {IsHtml:true})

This e-mail is formatted using HTML, but you are free to use a simpler text format if you want.

4 REPLIES 4
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Exporting Gallery from PowerApps

You need to create a string (text) with the message that you want displayed in the gallery. You can use the Concat function to do that. For example, the code below will send an e-mail with a formatted table with the items from the gallery:

Office365.SendEmail(
    "my-email@domain.com",
    "Forum post",
    "<p><b>Quote</b></p>" &
        "<table border='1'>" &
            "<tr>" &
                "<th>Service</th>" &
                "<th>Initial Charge</th>" &
                "<th>Quantity</th>" &
                "<th>Initial Discount</th>" &
                "<th>Total Upfront Cost</th>" &
            "</tr>" &
    Concat(
        Gallery1.AllItems,
        "<tr>" &
            "<td>" & Service & "</td>" &
            "<td>" & InitialCharge & "</td>" &
            "<td>" & Quantity & "</td>" &
            "<td>" & InitialDiscount & "</td>" &
            "<td>" & TotalUpfrontCost & "</td>" &
            "</tr>",
        Char(13)) &
    "</table>",
    {IsHtml:true})

This e-mail is formatted using HTML, but you are free to use a simpler text format if you want.

JBailey
Level: Powered On

Re: Exporting Gallery from PowerApps

Amazing! Thank you Smiley Very Happy

BerkTuncel
Level: Powered On

Re: Exporting Gallery from PowerApps

Hi

 

How can we add image to email body in here.. For example peninput ? 

 

Thanks

Berk

Highlighted
Specoop
Level: Powered On

Re: Exporting Gallery from PowerApps

Also interested in this. Anyone find a solution?

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Top Kudoed Authors
Users Online
Currently online: 176 members 4,939 guests
Please welcome our newest community members: