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
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:
- Data source: Current item
- Field from source: ID
- Return field as: As Double
- 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!
Leave a Reply