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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Generate Sequential Au...
Power Automate
Suggested Answer

Generate Sequential Auto Number

(1) ShareShare
ReportReport
Posted on by 20
I am trying to build a flow that creates a sequential automatic number when an item is created in my Sharepoint list. I want the number to include the two-digit year followed by a dash and then a sequential number (i.e., 0001, 0002, etc.). I know I can do this by using formatdatetime() in the field I want to update. However, I need the sequential number on the end to restart at the beginning of each year, so tying the sequence to ID will only work for the remainder of this year. How can I format the second half of the number to meet this requirement?
 
Currently I am formatting the date via the following:
formatDateTime(utcNow(), 'yy') - formatNumber(triggerOutputs()?['body/ID'],'0000')
 
Categories:
I have the same question (0)
  • Suggested answer
    Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at
    Hi,
     
    Try like this
     
    assume the sharepoint list has title column has the sequential number like below
     
    Now let's see how flow looks like
     
    I am manually trigger for the demo purposes, u can change the trigger depending upon need.
    1. Use get items to get the last added item with following highlighted parameters

       
    2. Now check whether the last added items year is equal to current year, this is done by taking year part of sequential number column (title is in format of yy- seq number)

      expression used - 
      split(first(outputs('Get_items')?['body/value'])?['Title'],'-')?[0]


       
      3. If the condition is true,follow below steps in yes branch
       
      Use compose action to increment seq number as shown below
      Expression - 
      formatNumber(add(1,int(split(first(outputs('Get_items')?['body/value'])?['Title'],'-')?[1])),'0000')
       
      Now use the expression to create the item in SP list as shown below
       
       
      4. if the condition is false, follow below steps to create new item so that sequential number can be reset for new entry in new year 
       
       
      Hope it helps !
      Thanks & Regards,
      Nived N 
      LinkedIn: Nived N's LinkedIn
      YouTube: Nived N's YouTube Channel
      Blog: Nived Nambiar's Blogs
       Found my answer helpful? Please consider marking it as the solution!
       Your appreciation keeps me motivated. Thank you!

       
       
  • lbendlin Profile Picture
    8,479 Super User 2025 Season 2 on at
    You already have the automatic sequence number from the SharePoint list.  Is that not sufficient?
  • KG-13081359-0 Profile Picture
    20 on at
    @lbendlin
     
    the ID number that Sharepoint already creates would be fine for now, but when 2024 becomes 2025 I need the number to restart at 0001, not continue based on however many items are in the list
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,488 Super User 2025 Season 2 on at
    Hi,
     
    Here is the issue, you cannot guarantee its going to be in order due to how Power Automate Works.
     
    1. How does flow run instance 26 know its the 26th and should show 0026? It would have to know the previous number.
     
    Problem: If 4 flow instances are all running at the same time and all of them ask, hey what was the last one used and they all get the answer 0025
    they all then set themselves to be 0026.
     
    You said sequential  so I am assuming you want it to use the "current Next" value compared to the previous? or do you not care that many have the same sequence number?
     
  • KG-13081359-0 Profile Picture
    20 on at
    @FLMike
     
    Each number needs to be unique. Based on the way the list will be utilized I think it is probably unlikely that multiple flows would pull the last number at the same time, but I see how that possibility would be a problem.
  • lbendlin Profile Picture
    8,479 Super User 2025 Season 2 on at
    When 2025 rolls around create a new list.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard