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.
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.
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.
last(outputs('Get_items_from__list')?['body/value'])['ID']
Useful, thanks a lot!
User | Count |
---|---|
27 | |
14 | |
12 | |
10 | |
9 |
User | Count |
---|---|
50 | |
29 | |
28 | |
24 | |
20 |