I need to create an auto-increment field with a standard amount of digits. The format needs to be like this T000001, T000002, T000003, ......T000010, etc (7 Digits). When it gets to the 10th record it should not do this T0000010 (8 digits).

I tried using the popular, often referenced solution (link below). This method does not work as I hoped. If you put it in a format like this T1000, when it gets to the 10th item it does this T100010 rather than T10010.

Here is the popular solution I already tried: https://www.epmpartners.com.au/blog/how-to-create-an-auto-incrementing-number-field-in-a-sharepoint-list/

  • This isn't going to be very helpful as I can't remember the exact details, but like 7 years ago I had the exact same requirement as you. How I solved it was to use a SQL table to hold the "current" number of the IDs. Basically there was a row where the ID was the type of ID and there was a column with the current number (e.g. 7). Then whenever a new item was created, it looked at the database, retrieved the number and incremented by one, then wrote that back to the datatase. I believe it was through InfoPath but you might be able to do the same sort of thing with SharePoint Workflow Jan 31, 2020 at 1:11

1 Answer 1


Use jQuery to get list item count and init for Auto-Increment Field, this can avoid item delete.

Insert script editor webpart into list new form and insert the script into script editor webpart(Update the TxtField to your field name).

<script type="text/javascript" defer="defer">
    var site = "site Name";
    function pad(n, width, z) {
        z = z || '0';
        n = n + '';
        return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
    $(document).ready(function () {
            url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('MyList')/ItemCount",
            method: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            success: function (data) {                    
                if (data.d.ItemCount > 0) {
                    var field = "T1000"+pad(data.d.ItemCount, 3);
                    $("input[title='TxTField']").val(field).prop("disabled", true);
            error: function (data) {
                alert("Error: " + data);


enter image description here

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.