cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
carem
Level: Powered On

Auto generate Reference Customer ID into specific format in Sharepoint List

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

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.

5 REPLIES 5
abm
Level 10

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-...

 

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

Community Support Team
Community Support Team

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
Level: Powered On

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.

 

Community Support Team
Community Support Team

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
Level: Powered On

Re: Auto generate Reference Customer ID inlott specific format in Sharepoint List

Thanks, @v-litu-msft 

Helpful resources

Announcements
firstImage

Microsoft Flow Online Conference

Join us for a FULL day of FREE Microsoft Flow Sessions from some of the best minds in the industry!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 180 members 5,368 guests
Please welcome our newest community members: