cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AkshayManke
Continued Contributor
Continued Contributor

Generate Custom ID for SharePoint Using MS PowerAutomate

Hello,

 

I know that this question is asked several times. But i have a slightly different requirement.

 

I wanted to generate a custom ID using Flow, when a new item is created in a SharePoint list. The Custom ID will be written in a SharePoint Column.

 

The Requirement is like as below:

1. There will be a prefix of ABCDEF then 0000 and then the default ID

2. If the ID is 1 then the Custom ID should be ABCDEF00001

3. If the ID is 212 then the Custome ID Should be ABCDEF00212

 

Can anyone please help that how to achieve this?

 

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @CFernandes@ScottShearer,

 

I got the solution in the below link.

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

 

I used formatNumber expression and got the custom ID for the list items. However many thanks to both of you for your help and guidance on the request.

 

Regards,

Akshay

View solution in original post

5 REPLIES 5
CFernandes
Super User
Super User

Hi @AkshayManke 

 

Perhaps you might want to create a condition and check it the number is less than 99,

 

YES - 

concat('ABCDEF0000',outputs('Get_file_properties')?['body/ID'])
 
NO-
concat('ABCDEF000',outputs('Get_file_properties')?['body/ID'])
 
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!
 
 
 

Hello @CFernandes,

 

Thanks for the quick reply. However i am unable to corelate the expression with my SP List. Can you please share more details like what i need to add and where? You have given the right example and I tried that using a condition but somehow not getting the desired results and failing at the expression. 

 

Below my Details:

SharePoint List Column: ID

Prefix to be Added as Below:

Till 99 = ABCDEF000099

Till 999 = ABCDRF000999

Till 9999 =ABCDEF009999

Till 99999 = ABCDEF099999

 

Many Thanks in advance.

 

Regards,

@AkshayManke  I think you might have to nest conditions(use Multiple conditions) in the Power Automate. 

 

Check if less than 99 

Check if it less that 999......

 

CFernandes_0-1600347994550.png

 

I cannot think of a better idea, right now with reference to your scenario(Perhaps our community members might have better ideas)

 

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!

 

 

ScottShearer
Super User
Super User

@AkshayManke 

Please take a look at my solution below.  I could have made it with fewer actions but did it the way I did for clarity.

I have a separate SharePoint list where I store the next ID number that I'll be using and that list has only one row. 

The issue you are having is that Power Automate does not have an expression that allows you to take a certain number of characters from the right side of a string.  I work around that by using the skip() expression.

Please let me know if you have any questions.

ID1.jpgID2.jpgID3.jpgID4.jpgID5.jpgID6.jpg

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Hello @CFernandes@ScottShearer,

 

I got the solution in the below link.

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

 

I used formatNumber expression and got the custom ID for the list items. However many thanks to both of you for your help and guidance on the request.

 

Regards,

Akshay

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (1,927)