Hi All
I have built a document number generator that works fine except sometimes it will end up with two documents with the same number. The generator works by either a new item trigger in a List or a new item via a power app.
I have 2 lists,
1, MasterDataList.
2, RefGenList (1 tem list with the last document number is stored).
This is the basic order of the flow:
New item in MasterDataList >Trigger(RefGenFlow) > Get Item (last DocNumer from RefGenList) > Increment DocNumer > Concat DocNumber with prefix (ie REF000123) > Update Item (New DocNumer back into RefGenList) > UpdateItem into MastDataList.
I'm guessing that concurrent new Items are running, and in between Get Item (DocNumber) > Increment > Update Item, the other new item is swooping in and grabbing the same Doc Number.
I have updated my flow to Get > Increment > Update successively to try and reduce the chances of double-ups but I am concerned it is not enough.
Soooooooooooo
1, Is there a better method for this than what i am doing?
2, Im Pretty sure i cant lock the item in the list (other than change privileges) can i Lock the flow so others can't trigger it until i have finished?
3, Time delays the flow, ie when I 1st trigger it cant be retriggered for say 20ms (should be enough)
Any suggestions would be greatly appreciated.
I have a fair bit of experience in microprocessors and real-time operating systems, so dealing with timing issues is almost number 1 in that environment. Just not sure how to tackle it here.
Cheers Anthony
Categories: