How to create a custom unique ID based on SharePoint item ID column?
Last Update: December 27, 2018
Apply for: SPARK Workflow for SharePoint 2013/2016 and Office 365
Suppose you have a list named "Tickets" and you want to create a workflow over this list to generate a custom unique ID for each created item in this list using this format: TKT-00001, TKT-00002, …TKT-00003 (the custom ID can go up to TKT-99999), after that, you want to assign the generated custom ID value to the "Ticket ID" column.
Here are the steps on how to
- Create a new list workflow. For more details on how to create a list workflow, refer to
Create a list workflow use case.
- Drag "Set Activities" activity onto the workflow canvas and drop it onto a design node
then drag "Math Operation", "String Builder" and "Update Item" activities inside the "Set Activities" activity and then rename the activities as follows:

- Configure "Set Activities" activity as follows:
- Configure "Math Operation" activity as follows:
Note:A workflow variable named "varLeadingZerosCount" of type integer should be created to store the count of leading zeros. - Configure "String Builder" activity as follows:
Note:: A workflow variable named "varTicketID" of type string should be created to store the generate ticket id. - Configure "Update Item" activity as follows:
- Publish the workflow by clicking on the
Publish button in the workflow ribbon.
- Now you can test the workflow by adding a new item to the list that this workflow being created on.