cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jared_Simon
Helper I
Helper I

sharepoint list based unique case reference number with consistency

is there a way to use flow based solution on sharepoint list where a new entry in the list can generate a unique case reference number which will get incremented by one, but still with some consistency checks like, if an entry is deleted, the numbering is not reused? 

4 REPLIES 4
Pstork1
Dual Super User
Dual Super User

The easiest way to do that is to sort the list using ID in descending order and take the first record.  That will give you the last ID used.  Add 1 to that and incorporate that number when creating the new record and you'll have a unique reference number where numbers are not reused.  The only concern would be if two records are created at essentially the same time after reading the highest ID.  You could then have two records.  But reading the highest ID just before creating the record would minimize the time gap where that could happen so unless the system is heavily used you would be OK.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Jared_Simon
Helper I
Helper I

Thanks - I will test that. not much concerned about two users hitting submit same time as i don't expect that kind of traffic. is there a way to reset the ID to 1 after all tests?

You can only reset the ID on the SharePoint list by deleting and recreating the list.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
PompusMaximus
New Member

Use a "When Item is Created" trigger.

Add your list info.

 

Then for your reference number field, insert this function:

 

concat('LFV',formatNumber(triggerOutputs()?['body/ID'],'000000'))


The LFV is a header that can be whatever you make it.  The '000000'  is how many numbers you want to default showing.  The ID field is being used as the number generator and will always increase by one.  The only issue I've found is there is about a 30 second delay or so for the SharePoint list to update the field but it works.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (1,252)