SharePoint Online: Create Unique Auto Increment Column using SharePoint Designer Workflow

Requirement: Create a unique auto increment column in SharePoint Online list.

How to Set Unique number Column with SharePoint Designer Workflow?

We can create a unique auto number column in SharePoint using SharePoint Designer workflow. The overall idea is:

  1. Create a custom list, name it as “UniqueID” or something like that. Leave it with just the default “Title” column and add a row with Title field value to “1” (Just one row!).
  2. In “Requests” list (or whatever list you need unique ID column), Create a SharePoint designer workflow, get the value of “Title” from UniqueID list, set the value of “Reference Number” or whatever column to the value from UniqueID List. Set the workflow to trigger on new item creation.
  3. Increment the “Title” field value of UniqueID list by 1 and update UniqueID list. (with ID=1, we’ve created only one row)
  4. Make sure the “Reference Number” column in the “Requests” list is set to read-only in NewForm and EditForms using JavaScript.

Here is the Auto number generation workflow in action:

sharepoint unique auto incrementing column

Steps:

  1. Create workflow variables: varCounter and varCounterPlusOne of Number type.
    sharepoint online list create unique number with sharepoint designer workflow
  2. Set the variable varCounter from UniqueID list item with ID =1 
    sharepoint create unique reference number
  3. Update the current item’s “Request ID” in Requests list with the variable varCounter
    sharepoint online create unique id column
  4. Increment varCounter by 1 and store it to varCounterPlusOne
    sharepoint designer workflow unique id column
  5. Update the UniqueID column’s row with the value of varCounterPlusOne.
    sharepoint online workflow generate unique number

Advanced Scenario: Create Unique Reference Number from Multiple Columns

Here is another scenario where I need to generate unique and auto-increment values based on multiple column values. When a new entry is added to the Asset Register list, “Tracking Number” should get auto-populated based on the “Device type” field value selected and the “Tracking Number” field value should be unique. This tracking number should be framed as : Shortcode of the device and an Incremental number. E.g. For the first request under “Desktop” device type, it should be “DS#1”, for the second request, it should be “DS#2” and so on.  Here is the list of device types and shortcode:

generateauto number in sharepoint online

Workflow snapshot:
auto increment number workflow
The “Device Type” field in Asset Register list is a lookup field referencing “Title” column of the “Device Type Config” list which has all devices, short codes of the device and a sequence number. So when a new request is added to Asset Register list, we need to get the sequence number and device short code values from the parent lookup list “DeviceTypeConfig”.

sharepoint online list create unique number

Result of the auto generated tracking numbers through workflow:

sharepoint designer workflow auto generate number

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply