cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
xxxxmints
Helper IV
Helper IV

Need help with Flow for incremental auto number and multiple instances of the Flow at the same time

Hello I had a workflow in SharePoint Designer that worked nicely creating an incremental auto number (year plus number) for an approval workflow that I changed to Flow at the beginning of this year. I've recently discovered there have been issues with it recreating the same number or going back to a previous number. I now have requests with the same number!

 

I have two lists: one with an approval workflow that needs the auto number at the end of the flow to send an email; the other where the auto number is created.

 

I'm pretty sure it's when someone approves a bunch of the workflows for the first list and do it in quick succession and so stuffing up creating the auto number in the second list.

 

I thought about putting a one minute delay in some of the steps, but that's not going to work if the approver approves a few workflows in quick succession anyway. I was hoping someone might have some advice. Here's what the flow looks like. The last image is the list the auto number is created in.

 

Any help is greatly appreciated, than you 🙂

 

 

2020-09-21 08_54_59-Window.png

 

 

2020-09-21 08_55_58-Window.png

2020-09-21 09_06_43-Edit your flow _ Power Automate.png

 

 

2020-09-21 08_58_10-Window.png

1 ACCEPTED SOLUTION

Accepted Solutions
thjeffri
Microsoft
Microsoft

Hi xxxxmints,

 

I think you have probably identified the issue exactly correctly, which is that this is most likely to happen when someone triggers your flow many times in a short span.

 

Here is one method you could use to prevent the issue:

  1. Combine the two flows you described into one flow AND
  2. Set the Concurrency Control on your flow's trigger to 1

 

To set the Concurrency Control, select your flow trigger, click the ellipsis (...) icon in the top right, then select Settings.  On the Settings window, set Concurrency Control to On.  You can then set the Degree of Parallelism to 1.

 

The point of doing this is to make sure that your flow has completed and your counter has been incremented before the flow is triggered again.  The downside of doing this is that you limit yourself to the flow running one-at-a-time, which could have the net effect of a performance decrease when many flows are triggered at once.

 

There may be other ways to do this.  This is just one possible idea.  I hope this helps!

 

Tom

View solution in original post

6 REPLIES 6
thjeffri
Microsoft
Microsoft

Hi xxxxmints,

 

I think you have probably identified the issue exactly correctly, which is that this is most likely to happen when someone triggers your flow many times in a short span.

 

Here is one method you could use to prevent the issue:

  1. Combine the two flows you described into one flow AND
  2. Set the Concurrency Control on your flow's trigger to 1

 

To set the Concurrency Control, select your flow trigger, click the ellipsis (...) icon in the top right, then select Settings.  On the Settings window, set Concurrency Control to On.  You can then set the Degree of Parallelism to 1.

 

The point of doing this is to make sure that your flow has completed and your counter has been incremented before the flow is triggered again.  The downside of doing this is that you limit yourself to the flow running one-at-a-time, which could have the net effect of a performance decrease when many flows are triggered at once.

 

There may be other ways to do this.  This is just one possible idea.  I hope this helps!

 

Tom

View solution in original post

Hello @thjeffri 

Thanks for your help on this.

 

The Flow is already one (not 2 as you have suggested). The first half is the starting and waiting for approvals. I really need that to keep happening. The second part is the incremental auto number (which is where the issue is).

 

Will setting the Degree of Parallelism to 1 stop a Flow from being initiated while one is running?

 

What if I set the Degree of Parallelism on the Apply to Each which is after the approvals have been approved and the auto increment starts?

 

Thanks again.

 

Hi xxxxmints,

 

Yes.  I should've explained it better, but setting the Degree of Parallelism to 1 will make sure the flow runs only one instance at a time, queueing up further requests to trigger the flow.

 

You could set the Concurrency Control on your loop, but that would not prevent multiple instances of the flow from running simultaneously.

 

Tom

Hi Tom

Sorry but this is not clearer for me.

Can I set the Degree of Parallelism to 1 in the Apply to Each half way through the Flow, which would mean the approvals go through and bank up while the auto number is incremented one at a time?

 

 

 

Hi @thjeffri 

Are you able to explain the above to me? Is it ok to set it on the Apply to Each half way through the Flow and not on the trigger?

Hi xxxxmints,

 

Yes, it's OK to do either, or both.  They just do different things.

 

Setting the Degree of Parallelism on the flow to 1 means that the flow will only trigger one at a time.

Setting the DoP on the Apply to Each loop to 1 means the loop will process one item at a time.

 

Tom

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,297)