How to create a custom ID for lists and libraries

This post looks at how you can auto-populate a custom list/ library – for both classic and modern SharePoint…

Custom ID column – classic SharePoint

1. Pre-requisites

Before you begin you will naturally need to create either a list or library in SharePoint. You will also need SharePoint Designer 2010 installed to create this system, you can download the 32-bit version from Microsoft here, or the 64-bit version from CNET here.

2. The setup

  • Create a new column, with the type Number – I called this ‘SolIncrementNum
  • Create a new column, with the type Calculated – I called this ‘SolReqNum‘, later renamed ‘Request Number’ in the formula field, add the following: ="SOL-00"&[SolIncrementNum]
  • For the Data Type, select Single line of text
Setting the formula for the solReqNum column in list settings

NOTE: for the Request Number formula if you want to prefix your custom ID with something else just replace what’s between the ” “ in the formula field above.

3. Build the workflow

Next up, we need to connect to the list in SharePoint designer to build our workflow to populate the SolIncrementNum with the SharePoint generated ID of the list item.

  • Open SharePoint Designer 2010 > Press Open Site > Copy and Paste the URL of the site which you are building the system in
  • In SharePoint Designer 2010 under Lists and Libraries > select the list or library in question
  • In the Workflows section press New, then give your workflow a name and description
  • In the workflow designer start typing “pause”, this will add a new action called “Pause for 0 days, 0 hours, 5 minutes”
  • Press enter, underneath the Pause action, start typing “update”, this will give you a new action called “Update item in this list”
  • Press the words “this list” that are underlined (this will open a new window) > make sure the list drop-down is set to Current item
  • Press Add make sure the following fields are set:Set this field: select SolIncrementNum
  • To this value: press the fx button
  • A define workflow lookup window will appear, make sure the following fields are set:
    1. Data source: Current item
    2. Field from source: ID
    3. Return field as: As Double
    4. Press OK
  • Underneath the previous action start typing “Stop”, this will create a new action that stops the workflow and logs a custom message > click on “this message”
  • Enter your custom message, for example: “ID copied successfully”
  • Press Save to save your workflow, then Publish to make it live
  • At the top of the workflow designer canvas there is a breadcrumb menu, press the link before the word “editor” (the name of your workflow)
  • This takes you to the workflows properties, under Start Options > make sure Start workflow automatically when an item is created is checked
  • Save and publish your changes

Now when new items are created within the list or library, the workflow will fire and create a new request number!

Classic SharePoint list with SharePoint Designer workflow that populates Request Number

Pages: 1 2

8 responses to “How to create a custom ID for lists and libraries”

  1. Hi,
    I’m following Modern SharePoint steps to populate a Request ID. After adding a new item, it returns to my list view. The Request ID does not include the [ID] immediately in the list view. After a few minutes, the Request ID refreshes to include [ID]. Is there anything I can do to have the list view show the correct Request ID immediately after adding an item?

    1. Hi, thanks for the comment. Unfortunately there will always be a time gap between the item being andded and Power Automate running a flow and updated the item.

      The only way I can think for you to have a request ID present is to use formulas in a calculated column. I found that can be problematic if you use the in-built ID column as your auto incrementing number but it’s worth trying. My classic example details how to do it or you can use this syntax reference as a guide https://support.microsoft.com/en-us/office/examples-of-common-formulas-in-lists-d81f5f21-2b4e-45ce-b170-bf7ebf6988b3

  2. Hi Anthony,
    The custom ID part works great, but I can’t get the number to increase incrementally with each new item.

    Any ideas?

    Many thanks!

    1. Hi Ross, are you following the classic or modern example? Both solutions use the in-built ID column to create the incremental number – are you doing that?

  3. Hi Anthony, got it working, however I need the numbers to be automated, so instead of people selecting any odd number, I’d like the flow to pull the unique ID somehow. I can’t figure out how to use it in my Calculated formula, and via the Flow I can’t quite figure out how to do it either.
    I would really appreciate your help if it’s something you came across before?

    1. Hi Alice,

      Thanks for commenting. In my example flow I use the inbuilt list item ID column to create a automated incremental number. Have you tried that? Thanks Anthony

  4. Fantastic, worked perfectly, thank you! I needed my IDs to start with D and begin at 10000 so I used formula =”D”&(solIncrementNum+10000) to get D10001.

    1. @Juliana really happy to hear this worked for you ☺️

Leave a Reply

Recent posts

Discover more from SharePoint Stuff

Subscribe now to keep reading and get access to the full archive.

Continue reading