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 / Preset body of email t...
Power Apps
Answered

Preset body of email to pull information with data in specific order

(0) ShareShare
ReportReport
Posted on by 43

Hi,

 

I have been trying to pull information different ways and i am still getting stuck. 

i have a set of data in a gallery that when i send the email i want the information to pull the data in a specific order. 

i have created a collection with the following code below which is run on start of the app

 

ClearCollect(
LocationSort,
{
Order: "a",
Title: "BNE Central"
},
{
Order: "b",
Title: "BNE Downtown"
},
{
Order: "c",
Title: "GRT Springfield"
},
{
Order: "d",
Title: "GC Central"
},
{
Order: "e",
Title: "GC North"
},
{
Order: "f",
Title: "SC North"
},
{
Order: "g",
Title: "SC South"
},
{
Order: "h",
Title: "DRW Malak / Palmerston"
}
);
ClearCollect(
CampusSort,
GroupBy(
LocationSort,
"Order",
"Title"
)
)

Then on the email button i have the following code:

Sort(
LocationSort,
"Order"
);
Office365Outlook.SendEmailV2(
User().Email,
"State Lead Service Report for" & " " & DDServiceBlock.Selected.Result & " " & DdDate.Selected.Result,
Concat(
Gallery3.AllItems,
"<p><br><b>" & GLCampus.Text & "-" & BsubmitBy.Text & "</b><br>" & "</b><br>" & GFinalRepor_1.Text & "</p>" & "</b><br>"
)
);
Notify("Email Sent")

However the information still doesnt want to pull the data based on the order specified onstart.

 

Any help would be appreciated. I even thought of hardcoding the body of the email but unsure how to do that. 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    Hi @AliDg2 ,

    There is a bit missing here  - firstly LocationSort is already in order. Then using GroupBy on CampusSort, is not necessary as you have all unique values already and it simply turns Title into a one-item table.

    Now the last bit, what are the Items of Gallery3 - I am assuming GLCampus is the Title field? If so (as above) it will be a table. 

  • AliDg2 Profile Picture
    43 on at

    Hi @WarrenBelz 

     

    i think i was trying different solutions. so if i take the group by out that should solve half the problem?

    the items of gallery 3 is the Title field that is correct. 


     

  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    Hi @AliDg2 ,

    You can simplify this a lot - forget your collection and the order takes care of itself - the Items of the Gallery

    [
     "BNE Central",
     "BNE Downtown",
     "GRT Springfield",
     "GC Central",
     "GC North",
     "SC North",
     "SC South",
     "DRW Malak / Palmerston"
    ]

    I assume the two text boxes are in the Gallery. Then your email

    Office365Outlook.SendEmailV2(
     User().Email,
     "State Lead Service Report for" & " " & 
     DDServiceBlock.Selected.Result & " " & ddDate.Selected.Result,
     Concat(
     Gallery3.AllItems,
     "<p><br><b>" & Value & "-" & BsubmitBy.Text & "</b><br><br>" & 
     GFinalRepor_1.Text & "</p>" & "</b><br>"
     )
    );
    Notify("Email Sent")

    I assume you are in SEQ  . . I am up the Bruce about 600k

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • AliDg2 Profile Picture
    43 on at

    Hey @WarrenBelz ,

     

    for the Items property of the gallery i already have the following code. Because i users enter the data at random times not sure how to make that work?

     

    not quite sure what you mean above sorry are you able to elaborate further?

    If(
    //all and all
    DdDate.Selected.Result = "All" And DDServiceBlock.Selected.Result = "All",
    // all dates and selected block
    'TestingAPP-WeekendServiceReportList',
    DdDate.Selected.Result = "All" And DDServiceBlock.Selected.Result <> "All",
    Filter(
    'TestingAPP-WeekendServiceReportList',
    ServiceBlockAmPM.Value = DDServiceBlock.Selected.Result
    ),
    // selected date and all blocks
    DdDate.Selected.Result <> "All" And DDServiceBlock.Selected.Result = "All",
    Filter(
    'TestingAPP-WeekendServiceReportList',
    ServiceDate = DdDate.Selected.Result
    ),
    // selected date and selected block
    DdDate.Selected.Result <> "All" And DDServiceBlock.Selected.Result <> "All",
    Filter(
    'TestingAPP-WeekendServiceReportList',
    ServiceBlockAmPM.Value = DDServiceBlock.Selected.Result And ServiceDate = DdDate.Selected.Result
    )
    )

  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    Hi @AliDg2 ,

    Firstly, you can tidy that up to the below

    Filter(
     'TestingAPP-WeekendServiceReportList',
     (
     DdDate.Selected.Result = "All" || 
     ServiceDate = DdDate.Selected.Result
     ) &&
     (
     DDServiceBlock.Selected.Result = "All",
     ServiceBlockAmPM.Value = DDServiceBlock.Selected.Result
     )
    )

    however I am confused now as to how the Campus Title ties in with 'TestingAPP-WeekendServiceReportList'. Can you please elaborate on this.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

  • AliDg2 Profile Picture
    43 on at

    i have the campus title is based on a text on my welcome screen. so the text follows through from there. and is added to the location based on the location selected from the welcome page

  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    @AliDg2 ,

    Yes, but you are sending the contents of the Gallery in the mail - how is that related to the Campus collection? Is that the GLCampus.Text?

  • AliDg2 Profile Picture
    43 on at

    ah sorry yes that is correct

  • AliDg2 Profile Picture
    43 on at

    i know i cant order a gallery without numerical or alphabetical format which when sending the email will put the data the way the gallery is listed.  but i don't know how to manipulate the data so that it pulls it in the order that i want 

  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    @AliDg2 ,

    There is a piece missing here - your gallery is based on the table 'TestingAPP-WeekendServiceReportList' - is there a Campus field in this that is displayed in the Text Box GLCampus and you are trying to sort it in the order of the collection you have made with the field in the Title?

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 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard