Unique alphanumeric list ID’s via SPD Workflow and Calculated Columns #SharePoint #SP2010 #in
A common thing I do for most clients is to create a unique alphanumeric ID that is consistent in length with pre-filled zeros.
Risk list alphanumeric ID example:
- RSK0001
However, as has been documented many times (link); you cannot use the ID column of a list in a calculated column. To get over this issue I use a simple SharePoint Designer workflow to copy the ID value to another column (Unique Reference) and then base my calculation on the Unique Reference column.
Step One: Create a common site column for use across the Site Collection
- Column Name: Unique Reference
- Column Type: Single Line Of Text
Step Two: Create a calculated column for the alphanumeric ID
- Column Name: Risk ID
- Column Type: Calculated Column
- Formula: =”RSK” & TEXT([Unique Reference], “0000”)
NB: The TEXT function will prefill the ID with zeros
- Step Three: Add the Unique Reference and Risk ID column to your List or Content Type
Step Four: Create the SharePoint Designer Workflow
- Create a list or content type (SP2010 only) workflow
- Workflow should fire on Creation only (disable Manual and Edit)
- Use the following steps:
- Publish the workflow (list workflow)
OR
- Assign the workflow to the content type (if you have created a redistributable workflow in SPD 2010) and assign the content type to the list (content type workflow)
Step Five: Hide the Unique Reference column in the list / content type
- This will stop the Unique Reference column from showing to the end user.
NB: You must hide the Unique Reference column after you have created and published the workflow otherwise it will not appear in SharePoint Designer
You list items will now have a unique alpha numeric ID
NB: Please remember that automatic workflows will not fire if you are logged in as the farm account (link)
Thanks, for the above. Really helped me out. The Risk ID gets set when a document is uploaded to the library.
How can I ‘pull’ the Risk ID back down and put it into an infopath form view for ‘readers’ to view?
Hi Andrew,
Thank you for your comments, I have emailed you directly about your question and once we reach a resolution I will post an update.
Kind Regards
Giles
Thank you so much for this write up. I’ve been struggling with this problem for a week now. I found other articles that accomplished the same thing but with much more complexity. I knew there had to be an easier way and I found it in your article.
No problem Sean,
Thanks for the feedback and really glad we could help
Kind Regards
Giles
Thanks! Really helpful.
Can you make the RSK0000 always add 1 when a new item is uploaded?
thanks for this WF but problem when i login user in this site they can showing a Error ” The file xxxx.docx has been modified by aaa\user i on 05 Apr 2013 13:05:34 +0530.”
Hi Ari, i don’t believe we have successfully used this technique against document libraries. Have you considered the document id feature available in SP2010?
I have trouble with your formula for the calculated column. It results in a syntax error for me and will not create the column. What is wrong?
Hi,
Can you copy the exact formula you are using into the comments box or perhaps send it via the contact page and we can take a look. I suspect it is just a syntax error.
Kind regards
Giles
Sure thing 🙂
I copied your formula from the post: =”RSK” & TEXT([Unique Reference], “0000″)
I altered it to this: =”GIS” & TEXT([GIS ID], “0000”)
The altered one above reflects the new first 3 letters that I want as well as the title of the site column that I created.
Thanks, I will set up the scenario tomorrow morning (UK time) and take a look.
Hi,
I got this working this morning, however I received an error if I copied and pasted the formula in. I had to double click on the field from the list for it to recognise the formula.
Could you give that a go and let me know how you get on please.
Kind Regards
Giles
Thankyou so much for this post. This was very helpful.
Hi Giles, thanks you so much for sharing this.
Short and easy to understand! It was really helpful!
But is it possible to reset the ID to start from 1 every month? For example, RSK09-001, RSK09-002, … in September and restart with RSK10-001 in October.
If sharepoint does not allow ID to be reset, how else can I do that?
Thank you.