web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Sorting the order of a...
Power Automate
Unanswered

Sorting the order of attachments in a variable

(1) ShareShare
ReportReport
Posted on by 14,605 Super User 2025 Season 2
hey everbody
 
I have a send email action in my power automate flow, in the attachements i am passing a variable varAttachments that holds all attachements i need.
 
in this attachments there is always 1 attachement that begins with invoice_xxxxx.
 
is there an easy way to sort the attachments order so the invoice one is always on first place in the email attachments?
Categories:
I have the same question (0)
  • AlexEncodian Profile Picture
    4,409 Moderator on at
    You could filter your current array for the file you want to appear first and then append the remaining items. Not sure its the slickest solution but it would work
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at
    I already appended all Attachments to the variable but i dont know how to sort them now
  • AlexEncodian Profile Picture
    4,409 Moderator on at
    1) Filter your array for invoice_xxxxx. You now have a single attachment
    2) Filter your array to exclude invoice_xxxxx. You now all attachments except invoice_xxxxx
    3) Append 2 to 1
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at
    ok, and can u tell me how i can sort it this way and append again? can u maybe show me via screenshots? i can not figure out the code as my main product is power apps xD
  • Verified answer
    mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at
    i found a way to solve my issue
     
    the order inside the array variable is depending on when you append the attachments to the variable.
    at the beginning i appended the other attachments before i appedend the Invoice attachment.

    now switching the positions, the invoice one is on first place followed by the others.
     
    cheers

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard