web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Auto generate Reference Customer ID into specific format in Sharepoint List

(2) ShareShare
ReportReport
Posted on by 120

Hi;

I want to make Customer IDs auto-generate, auto increase when a customer is added and the IDs is in a specific format in Sharepoint List:

- Depend on the value of ID Column

- Have 8 characters

- Initiate with"KH"

- And depending on the value of the ID column of the List has a number of character, the IDs generated will be

  • If ID = 1, the Customer ID is "KH000001"
  • If ID = 25, the Customer ID is "KH000025"

Number of zero characters = 8 - 2 - length of the ID value

I am not familiar with how to write the formula, so asking people can help me write it.

Thanks a lot

 

I have the same question (0)
  • abm abm Profile Picture
    32,600 Most Valuable Professional on at
    Re: Auto generate Reference Customer ID inlott specific format in Sharepoint List

    Hi @carem ,

     

    Please see this post

     

    https://powerusers.microsoft.com/t5/Building-Flows/format-a-string-with-leading-zeros-in-MS-Flow/td-p/213310

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

     

    Thanks

  • Verified answer
    v-litu-msft Profile Picture
    on at
    Re: Auto generate Reference Customer ID inlott specific format in Sharepoint List

    Hi @carem,

     

    Please have a reference on the following Data operations:

    Flow configuration:

    add(1000000,triggerBody()?['ID'])
    substring(string(outputs('Compose')),1,6)
    concat('KH',outputs('Compose_2'))

    Annotation 2019-08-15 154301.png

    Run result:Annotation 2019-08-15 154536.png

    Please have a try, I hope it can help you.

    Best Regards,

    Community Support Team _ Lin Tu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • carem Profile Picture
    120 on at
    Re: Auto generate Reference Customer ID inlott specific format in Sharepoint List

    Thanks, @v-litu-msft for very detail instruction. I try and succeed.

    Can you have a glace and help me with another Sale Order List, with some complicated columns.
    Sale Order List has: 

    The format of SO number will be: "SO" + something below

    - Number of People: 1,2,3,..... It will return S or M depend the Number is greater than 1 or not.

    - Priority: Normal, Urgent. It will return N or U depend on the Priority

    - Country ID: US, JP, GB, KR...... It will return the 2 characters of Country ID

    - Create (System): 14/10/2019,..... It will return the year with 2 characters last, like 19 in the example.

    - And the ID Column: 1,2,.... with the same formula you have instructed me before. Have 6 characters with a number of zero and ID in the tail.

    Example: 

    - The Sale Order for 2 people, urgent priority, Go to Japan, create in 16/09/2019 and have the ID 25 is:

    SOMUJP19000025

    Thanks and hope you have a nice day.

     

  • v-litu-msft Profile Picture
    on at
    Re: Auto generate Reference Customer ID inlott specific format in Sharepoint List

    Hi @carem,

     

    Please have a reference to the following screenshots:

     

    1. Initialize variable CustomerID and Temp.

    2. Determine the Number of People.

    Annotation 2019-08-16 093908.png

     

    3. Determine the value of Priority.

    Annotation 2019-08-16 093947.png

    4. Concat the Country ID and Created

    concat(concat(variables('Temp'),triggerBody()?['CountryID']),formatDateTime(triggerBody()?['Created'],'yy'))

    5. Concat the process ID of the previous reply.

    Annotation 2019-08-16 094038.pngPlease have a try, I hope it can help you.

     

    Best Regards,

    Community Support Team _ Lin Tu

     

  • carem Profile Picture
    120 on at
    Re: Auto generate Reference Customer ID inlott specific format in Sharepoint List

    Thanks, @v-litu-msft 

  • Jonaz Profile Picture
    4 on at
    Re: Auto generate Reference Customer ID inlott specific format in Sharepoint List

    Greetings @ @v-litu-msft 

    It is a success your solution to create an alphanumeric identifier, but now I am looking for information or some guidance to block the id that is generated with the creation of this flow, I do not know if you have an example or definitely can not be done in blocking the id in a list of sharepoint through Power Automate, I would be eternally grateful for any response or light to this situation.

    This is sought to be able to mount a flow of purchases and that in the future the id is not modified to avoid fraud.

    thank you I will be very attentive to your answers



     

    Flujo.jpg

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 659 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 386 Moderator

#3
chiaraalina Profile Picture

chiaraalina 290

Last 30 days Overall leaderboard