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 / Get Most recent item f...
Power Automate
Unanswered

Get Most recent item from SharePoint List

(0) ShareShare
ReportReport
Posted on by 278

I have created a flow to get the most recent response from a SharePoint List based on the SharePoint ID value.  I have created a temp variable (tempId) initialized to 0.  If the SharePoint List ID is greater than the tempId, the tempId is set to the SharePoint List ID. The tempId it set correctly, but when I try to use the tempId to Get an item, it is something completely different.  

 

 

Capture1.PNG

 

Capture2.PNG

 

Categories:
I have the same question (0)
  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    I would need to see the flow to understand what you are trying to achieve and how. But here is one method to get  the newest SharePoint item that was created - which will be the item with the highest ID:

    ekarim2020_1-1634163108499.png

    The ID stored in a variable:

    ekarim2020_0-1634163095479.png

    The variable used in a Get item action:

    ekarim2020_2-1634163383545.png


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • duncant Profile Picture
    278 on at

    @ekarim2020 I am trying to get the most recent response.  Instead of ID desc, I used Created desc and Top 5 (I've noticed although you choose one, more items are pulled).  I will try using the ...['body/value'][0]... instead.

     

    Capture3.PNG

     

    Capture4.PNG

     

  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    The following will get the most recently changed or modified list item from SharePoint:

    2021-10-14_14-48-52.png

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • duncant Profile Picture
    278 on at

    @ekarim2020 When you initialize the variable, does this create an apply to each? 

  • Verified answer
    Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    The results returned by Get items action is an array (the value property). To access all the items in the array (even if there is only one item in the array) Power Automate uses the Apply to each loop.

     
     

    2021-10-14_15-10-18.png

    To avoid using the Apply to Each loop when we only have one item, we can use an expression:

    ekarim2020_2-1634221059299.png

    But there is nothing wrong with using the Apply to Each loop if you want to.


    Ellis

     


    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • duncant Profile Picture
    278 on at

    @ekarim2020 I think I am getting the apply each while inside another apply to each, which is why I cannot initialize the variable to that value.    Instead, I went ahead and set the top count to one, got the ID directly, and removed the tempId variable. 

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