I am working on a SharePoint list(i.e. Student Registration) as a database for student registration details.

Each item need to be assigned an unique number(i.e.- 1st number start with "2017-001"). As there are multiple people making use of this list, I'd really like the "Registration Number" column to auto-increment with the next sequential number(i.e. 2017-001,2017-002,...). My requirement is when 1st item added to the list, it will assign 2017-001, next item should be 2017-002 and so on.

NOTE : I have tried with calculated column way but not getting acceptable result. So please suggest way/code to do it in jquery/js with the steps.

  • You asked jQuery/js solution. @dsouzajoel22 's answer works like a charm, please mark as answer?..
    – Gennady G
    Commented May 2, 2019 at 15:26

4 Answers 4


I would highly recommend using a workflow so you can utilize the built in ID column to build your own registration column. There is no guarantee that the value you create on the client side will be accurate or have collisions if multiple people are signing up at the same time. This could lead to scenarios where 2 users have the same registration number.

Using workflow and basing it off the internal ID column of the list ensures there will be no duplicates.

  • Thanks Eric.. I having same doubt, now i think the best way might be Workflow in this case. can you please suggest me the steps and process to create WF and how to align it with auto-increment column.
    – Nishant19
    Commented Jan 6, 2017 at 5:01
  • It is a basic on item creation workflow where you build a workflow variable with 2017- and insert the list item id to build your string, then update the list item with that variable. Commented Jan 6, 2017 at 13:10

Here is the code you requested

  1. Create a New Form
  2. Add a Content Editor
  3. Currently i am getting ID, you need to get your custom column value here
  4. After that you can form your custom ID based on JavaScript
  5. Then Insert the value in the field for e.g "Test" Column created in the list and make sure its hidden for users.
  6. When you click on save.. it will save the value
<script type="text/javascript" defer="defer">
$( document ).ready(function() {
                   url: site+ "/_api/web/lists/getbytitle('TestList')/items?$top=1&$orderby=ID desc",
                   method: "GET",
                   headers: { "Accept": "application/json; odata=verbose" },
                   success: function (data) {
                        if (data.d.results.length > 0 ) {
                             $("[title='Title Required Field']").val(data.d.results[0].ID);
                  error: function (data) {
                      alert("Error: "+ data);

  • Perfect, thank You much!
    – Gennady G
    Commented May 2, 2019 at 15:24

For JS you can go for this approach

1) get the latest record from the list and store it in a hidden field (this would be a field generated in the OOTB from but will be hidden for users). Incase the list is empty you can generate a value using JS.

  • Can you please provide the detailed process? Please provide js code, how to use it also. Thanks in advance.
    – Nishant19
    Commented Jan 5, 2017 at 12:00

I tried an approach with calculated column..please check this formula,

=CONCATENATE(YEAR(Created),"-",REPT("0",3-LEN([Custom ID])),[Custom ID])

But here you need to take care of the maximum value...(in your case maximum number is 3)so it will maintain numbers up to 2017-999.

if you are looking for more you can change the maximum value accordingly.


9999 ---> 4

99999 ----> 5

custom Id is given for testing purpose. you can give default Item Id in the formula..

let me know for any queries.

  • Thanks Pradeep but i have tried this approach already. The roadblock with this way is its not updating calculated column automatically. When you update 2-3 items and check, you can see the all items value are 2017-00 and ID is not set.
    – Nishant19
    Commented Jan 5, 2017 at 11:58
  • oh really...thanks for the reply...I will check :) Commented Jan 5, 2017 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.