Skip to main content

Notifications

Community site session details

Community site session details

Session Id : zkxrqirFio5KCY9KKo0UZb
Power Automate - Building Flows
Answered

Keeping Leading Zeros from Forms

Like (0) ShareShare
ReportReport
Posted on 9 Dec 2022 14:11:04 by 83

I have a form that asks for an ID number that should contain two leading zeros. How do I ensure that the leading zeros remain when building my flow? I would like to verify that the user submitted exactly a nine-digit number and that they keep the leading zeros if they input them that way. I do not wish to exclude numbers that don't have leading zeros. 

  • Verified answer
    Ellis Karim Profile Picture
    10,940 Super User 2025 Season 1 on 09 Dec 2022 at 15:56:58
    Re: Keeping Leading Zeros from Forms

    The following example should help:

     

    ekarim2020_0-1670601218853.png

     

    Your condition would be similar to the following:

    Snag_e8636cb.png

     

    I'm using the string function for 00 and 900 so that flow doesn't flag error that I'm trying to compare a string to an integer value.

     


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

  • dedgerton1 Profile Picture
    83 on 09 Dec 2022 at 15:01:42
    Re: Keeping Leading Zeros from Forms

    Would it be 3 separate "equals" rows under one condition? And do I replace your instance of 001234567 with Compose Output? These IDs could also start with "900," so how do I ensure that I'm not excluding those?

  • Ellis Karim Profile Picture
    10,940 Super User 2025 Season 1 on 09 Dec 2022 at 14:32:27
    Re: Keeping Leading Zeros from Forms

    Hi @dedgerton1 

     

    One option could be to treat the ID as a string.

     

    You could then check if the ID starts with '00', that the length of the ID is 9 and that it is an integer using expressions and the Condition action:

     

    isInt('001234567')

    length('001234567')
    startsWith('001234567', '00')
     

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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 97

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard
Loading started
Loading complete