Forum Discussion

MST97's avatar
MST97
Copper Contributor
Oct 09, 2019
Solved

Generate a unique number like ID in A SharePoint list.

Hello,

I have created a SP List. From what I see every item has a unique number (ID). I found out that there is impossible to reset this ID  number. I would like to add a column which generate a number every time when a new item is added, similare with the ID.  Is this possible?

  • may I ask why you would reset it if it needs to be unique? Technically speaking if you need to just go quarter to quarter with the number, type of thing, you could always just use a calculated column and user [ID] for first quarter, then if you have a hard reset of items, you can then go set that column to [ID] minus whatever your ID currently is at.

    It's not pretty, but depending on your use case on how that flows it could work assuming you no longer care about the numbers once you do a reset. Otherwise flow would be your solution and you could take a similar logic without needing to maintain another list, you can just update the flow to subtract however many you want to reset back too off of the ID column.

    The difference with option 1 vs. flow, is flow would set the individual list item number, using calculated method reevaluates the number for all the existing items once you change it.
  • may I ask why you would reset it if it needs to be unique? Technically speaking if you need to just go quarter to quarter with the number, type of thing, you could always just use a calculated column and user [ID] for first quarter, then if you have a hard reset of items, you can then go set that column to [ID] minus whatever your ID currently is at.

    It's not pretty, but depending on your use case on how that flows it could work assuming you no longer care about the numbers once you do a reset. Otherwise flow would be your solution and you could take a similar logic without needing to maintain another list, you can just update the flow to subtract however many you want to reset back too off of the ID column.

    The difference with option 1 vs. flow, is flow would set the individual list item number, using calculated method reevaluates the number for all the existing items once you change it.
    • Bibi_2006's avatar
      Bibi_2006
      Copper Contributor

      Hi ChrisWebbTech! I found a thread about how to get a SharePoint List column similar to the ID. In my case, I really need to find a solution or a workaround without needing to use the ID column (to avoid Jump in the sequential reference numbers when an entry is deleted). Could you please provide further details or, a step-by-step to create a flow for this end?

    • MST97's avatar
      MST97
      Copper Contributor

      ChrisWebbTechthank you for reply.  I achieve what I wanted. I choose to use your first advice. I added a calculated column and I done the difference between ID and a number. I use this list to store some data and using flow I create a word document from a template with them. The name of the document I want to start from 1. My ID list is 78 right now and I couldn't use it... that's way I wanted to reset the ID column/create a new column with a unique number.

      Thank youuuu very much!

       

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    MST97  I agree with jcgonzalezmartin, and one way you can do this is to have a separate list on your SharePoint site which just has 1 item for the increment number. Then you'll need Flow to get that number and add it to the item then update it +1 for the next item. If you need detailed steps for this come back to  us.

    Rob
    Los Gallardos
    Microsoft Flow Community Super User

  • Totally possible, but you need to feed that column by means of a process that runs behind the scenes such as a Flow

Resources