How to customize SharePoint list item IDs, without Power automate

Andrea Oh 0 Reputation points
2025-01-14T00:51:52.8566667+00:00

Hi experts

I had 2 types of custom IDs of SharePoint list items.

  1. Using power automate
  • ex) when an item create -> yymmdd-[ID]
  • [ID] is SharePoint ID column
  • It works but have to manage Power Automate flow for each SharePoint list.
  1. Calculated column in SharePoint list
  • ex) yymmdd-[ID]
  • conclusion, It's not worked

-> It worked first but when someone change any columns then calculated value changed.

the reason i thought is, calculated formula was changed Ex) yymmdd-[ID] to yymmdd-ID : suddenly [] is missing. So, values would be 250105-010 to 250105-000

Is there a way to only use SharePoint? to customize IDs?

Like,

  1. yymmdd-ID : ID would be 3 characters and increase 1
  2. When create item, then started with 001
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,191 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ling Zhou_MSFT 20,315 Reputation points Microsoft Vendor
    2025-01-14T06:48:19.51+00:00

    Hi @Andrea Oh,

    Thanks for reaching out to us. We are very pleased to support you.

    We can use SharePoint JSON formatting to display yyyyMMdd-ID.

    Here are the exact steps:

    • First create a Text column.
    • Right-click the column name > Column settings >Format this column > Advanced Mode. User's image User's image
    • Paste the following JSON and save.
        {
          "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
          "elmType": "div",
          "txtContent": "=toString(getYear([$Created])) + if((getMonth([$Created]) + 1) < 10, '0' + toString(getMonth([$Created]) + 1), toString(getMonth([$Created]) + 1)) + if(getDate([$Created]) < 10, '0' + toString(getDate([$Created])), toString(getDate([$Created]))) + '-' + padStart([$ID], 3, '0')"
        }
      
    • Here is my test result: User's image

    Please note that SharePoint JSON formatting simply displays the content by adding a div element to the page, there is no real value stored in the column. If you need the column to be used in places like Power Automate, the value of the column will be empty.

    If you still need the columns to hold real values, then Power Automate would be the best choice.

    If you have any questions, please do not hesitate to contact me.

    Moreover, if the issue can be fixed successfully, please click "Accept Answer" so that we can better archive the case and the other community members who are suffering the same issue can benefit from it.

    Your kind contribution is much appreciated.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.