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

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

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

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"

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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (19,743)