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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Generate Unique string...
Power Automate
Answered

Generate Unique string using SharePoint ID

(0) ShareShare
ReportReport
Posted on by 123

I have a SharePoint Document Library column called PermitNo. I need to update this on create new item with a unique string that uses SharePoint list ID . If the ID is 23, then the PermitNo should be FHD000023. Concat function will give me FHD23, no problem. I am accomplishing this with the expression -

Concat('FHD',String(variables('m_ID'))) where m_ID is avariable initiatized and set to list ID.

But I need to pad  m_ID with leading zeros. Essentially, the string should be 6 digits with leading zero.

I have seen couple of posts which use loop and they seem complicated. Is ther a function or expression that will solve this?

There should be a TEXT(ID,"000000") function in Flow to format numbers as string?

Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @YatinMumbai ,

     

    There is no  expression function for format numbers for leading zeros. Here are the steps you need to follow.

    I will explain each step below.

    First step is your input number (eg 23). 

    Next we need to construct a Do Until Loop where the length of input number match the total digit we want which is 6 in your case.

    So in your case the initial length is 2 (length of 23) so that means the loop will execute 4 times to add the leading zeros.

    To add the leading zeros we will use the flow Compose step. 

    Finally reassign the input number to compose output.

    So it's starts with 023, 0023, 00023 and finally 000023 which is the result we want.

     

    cc1.png

     

    Here are my test results:

    cc2.png

     

    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

  • YatinMumbai Profile Picture
    123 on at

    Sounds good. Will try this out and revert with Accept as Solution.


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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard