cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User III
Super User III

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

Highlighted
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"

Highlighted
Super User III
Super User III

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

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (8,319)