cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Oskarkuus Post Partisan
Post Partisan

How to get the latest entry in a Sharepoint list?

I want to build a flow that export the latest row from a a sharepoint list.

 

If i run the flow right after i added a new row to a sharepoint list, i want to get that specific row in my flow.

If i then make another row in my list, that one is the latest and should be extracted with flow.

 

How to do this?

 

I have set a compose action with this formula

body('Get_items')?['value']?[sub(length(body('Get_items')?['value']),1)]?['ID']

 

but that just extract the same row over and over from my list.

 

Dont get it.

3 REPLIES 3
Super User
Super User

Re: How to get the latest entry in a Sharepoint list?

Hi @Oskarkuus, the simplest way to do what you want is to have a SharePoint "When an item is created" trigger, then the first action should be a SharePoint "Get item" and you can follow that with whatever the next actions should be as shown in my example below. This will only fire whenever a new item is added to the list, in other words the latest item.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

whenItemCreated.png

Oskarkuus Post Partisan
Post Partisan

Re: How to get the latest entry in a Sharepoint list?

Yeah but i dont want to get the latest item all the time. I have maybe 20-50 items being created each day.

I just want the last item created at a specific time.

 

So i cant use the connector "when an item is created"
Id like a connector that do: "get the last item being created in this list when this flow runs"

Super User
Super User

Re: How to get the latest entry in a Sharepoint list?

Then you need to manually trigger the flow, use a Get items to bring back the whole list. Then in the advanced options of the Get items set order by to ID desc and set the top count to bring back just 1 item. Due to the get items action the subsequent actions will wrap themselves in an Apply to each but it will only apply to the 1 item returned. You can then run the flow whenever you want from the My flows list.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

MostRecentItemInSPList.png

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,784)