cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
carem
Helper III
Helper III

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
v-litu-msft
Community Support
Community Support

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.

View solution in original post

6 REPLIES 6
abm
Super User
Super User

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



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
v-litu-msft
Community Support
Community Support

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.

View solution in original post

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
Community Support
Community Support

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

 

Thanks, @v-litu-msft 

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (1,196)