I had a flow, which triggers by item added event in a SharePoint list. The flow relies on the order of items added to a list, i.e. it processes items using the queue approach. However, when items were added using a batch approach, the order is not preserved.
You can fix it by introducing an "orchestration" flow and a field in the list.
Add a new field
The field should have a boolean type with the default value "No". We will use it to track which items were processed. Thus it's a good idea to give it the name "Processed".
The "orchestrator" flow
The flow is triggered by item created event. Under the trigger settings enable Concurrency control and set Degree of Parallelism to be 1. That way we have only one running instance of the flow at a time:
Then we should get all unprocessed items from the list (there will be at least one, but maybe more in case of batching, so we grab all of them). To do that we need to add a filter and order query in order to have items in the order of creation:
Now we have a list of items, in the right order, which was not yet processed by the flow. Let's process them:
In the "Do Job" step you can do whatever you want, including a call to another flow, which will further process the event.
The last step is to set Processed = True for the item, so that the next execution will not pick this item.
That way items are processed in the order they are added to the list.
Title image attribution - Work vector created by stories - www.freepik.com