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 Automate / Get Last Item in Array
Power Automate
Answered

Get Last Item in Array

(0) ShareShare
ReportReport
Posted on by 50

I can succesfully retrieve a value from the first item in an array using this: 

body('TrackCont')?['Containers'][0]['eta_final_delivery']

Can someone tell me how to pull the same from the last item in the array? Array is of indeterminate length?

 

Thanks

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @Chauc3r 

     

    You can use the last() expression to get the last value from the index of the array.

     

    Thanks

  • Chauc3r Profile Picture
    50 on at

    Hi @abm,

    Apologies, I'm rather out of my depth here.

    I tried rewriting that as 

    last('TrackCont')?['Containers']['eta_final_delivery']

    but it didn't like it!

     

    Also if you were able to point me at an idiot guide to flow syntax that be amazing!

  • haroldk Profile Picture
    Microsoft Employee on at

    Looks like you need a closing )  

    last('TrackCont')?['Containers']['eta_final_delivery'])

  • Chauc3r Profile Picture
    50 on at

    Hey @haroldbk_msft ,

    I tried multiple versions of that guy with no luck.....

     

    Computersaysno.png

     

    100% confident I'm doing something idiotic!

  • Verified answer
    abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Try the below in a compose

     

    last(body('TrackCont')?['Containers']))

     

    See the runtime history and see what it outputs

     

     

     

  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Also see what this returns

     

    body('TrackCont')?last(['Containers'])

     

    Let me know how it goes. Once either of these expression works then its easy to extract the properties.

  • Chauc3r Profile Picture
    50 on at

    Sticking things into a compose and playing with them is probably the most useful tip I've ever had with Flow! Just makes things so much more visible!
    Thanks!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard