Search code examples
sharepointsharepoint-onlinecalculated-fielddocument-library

How to create a number field with prefix (ex: 00001) that increments whenever a document is added in SharePoint Online?


I created a calculated column and concatenated the id with a prefix, but it didn't work as expected. The reason was that whenever i upload a file, the formula in calculated field that contains the ID with the prefix is executed, then SharePoint creates the ID. So, the ID is being calculated as empty and only the prefix is showing.

  • What I used:

=CONCATENATE(REPT("0",MAX(0,5-LEN(ID))),ID)

What i would like to create is a number field with a prefix (ex: 00001) that increments whenever a document is added in SharePoint Online. In other words, it's like the ID column in a list but with a prefix of five digits.

Therefore, is there any solution for this problem?

Thank you 😁.


Solution

  • Using the calculate column formula, when creating an new item, the ID column and the calculate column are created at the same time, so the value of the ID column cannot be obtained, so the calculate column will be displayed as 0.

    But you can solve this problem by creating a flow.

    Please refer to the screenshot below:enter image description here