web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unable to get a flow t...
Power Automate
Answered

Unable to get a flow to assign sequential document numbers when uploading documents in bulk

(0) ShareShare
ReportReport
Posted on by 65
Hello Everyone,
 
I am having issue with a scenario that I need help with.
 
Here is the scenario : 

-A document is uploaded to a "Working documents" library with some metadata columns such as "document department", "Dcoument status", etc. 
 
-One of the metadata columns that this flow looks at, is the "document department".  This is a lookup column to another list called "Departments" (This departments list has departments and their short codes). Eg, Human resources = HR, Project delivery = PD etc. This department list also has a counter to store the number of documents uploaded against that department


-This is the departments list that the above "Document department" column is looking up

-So what the flow does is the following : 
     -When document is uploaded in working library, and the "document department" is populated with a value, this flow kicks in
     - Note  There is a "flowrun" column in the above "working documents" library, which the flow uses as a flag. This flowrun value is defaulted to "no" for newly uploaded document, and later changed to "yes" when this flow starts. This is to just let the flow know that it has to look at the latest uploaded document (the flow run for all previous documents will be yes whenever this flow completes). This is to help assign unique doc number to the currently uploaded document.
     -This flow then looks up department list, appends the department short name, with a sequential number. (Eg, if department is Project delivery, then the numbers go like PD-001, PD-002 etc)
     -In above example, document number is PD-178. If I upload the next document for "project delivery", number will be PD-179
 
 
THE ISSUE : 
-----------------
The flow works well, if I upload one document at a time.  But the ISSUE is when I upload multiple documents simultaneously.  In that case all those documents are assigned same number (Eg PD 179), which is wrong.  So document number sequencing not working when uploading simultaneous docs
 
HERE IS FLOW :
--------------------


Trigger condition 




The below actions come in the "Yes" logical branch. here are some variables initialized






Then a apply to each loop to update doc count variable

Then another apply to each loop to update document list with the above "Doc count" Variable & set the document number


This is the next step (inside this "update document and list properties" loop, that actually sets the doc number


Then condition to check if "document number" column in library is null, only then populate it with the above set document number



Then if yes the document number (that was set above) is assigned to the uploaded document

 
 
As mentioned, this flow works fine, when I upload one document at a time, and the correct sequence is applied. When I upload 10 documents at a time (For example), all those 10 documents are assigned the exact same number, which is wrong. 
 
any suggestions on how this flow can be modified to handle simultaneous document uploads?
Categories:
I have the same question (0)
  • Verified answer
    Ellis Karim Profile Picture
    12,201 Super User 2026 Season 1 on at
    Hi SPUser1980,
     
    Try setting the Concurrency Control to 1. This should ensure that only one instance of the flow is running at any given time. If new instances of the flow are triggered while one is already running, they will be queued and will automatically start in order once the current flow finishes. 
     
     
    Ellis

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard