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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Generate a unique ID i...
Power Apps
Unanswered

Generate a unique ID in a form field.

(0) ShareShare
ReportReport
Posted on by 321

Hi,

So, I have a form in my App, which creates a Work Item (writes to a SharePoint list).

 

My work items all need a unique reference number which will be populated based on options selected throughout the form. 

 

So, in my SP list I have a choices column for department, when the user fills the form in on the App they select the relevant department from a dropdown.

 

Lets say in this case they select 'Maintenance' department. I want this to populate a unique reference number in the 'WorkItemRef' textinput box in my form (WorkItemRef is a column in my SP list' in the following format 'MAI' then the ID column number +1. So for example if I have 100 work items, when someone else adds a new one it would populate the WorkItemRef, so when the form is submitted it will add the ref to the WorkItemRef column in my SP list.

 

Hope this makes sense.

 

Thanks

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @JimboSey My suggestion would be to use a Flow and a SharePoint list to generate the ID.  You could use a list with a single row and columns for each department or a row for each department.  The Flow could return and ID to the Power App and then increment the number by 1.  I am assuming that you want a different series of incremental numbers for each department.

     

    Let me know if you need help with the Flow.

  • JimboSey Profile Picture
    321 on at

    Thank you for your reply.

     

    I am a novice with Flow, so any help on how to achieve the above would be greatly appreciated.

     

    Just need to bare in mind the reference needs to use the format MAIXXXXX so the Xs represent unique numbers. But there will be different departments so Collections deparment would be COLXXXXX

     

    Thanks

  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    Finding the next number available is always problematic using a SP list because 2 people may be adding items at the same time. It may be better to come up with a scheme based on date and time of day.

    You can use a variable as the Default value to be written to the list. You can use the Concatinate() function to assemble the parts you need. Something like:

    Concatenate( Left(  Department,3), Right(Text(Now(),"######"),6))

    Would give you the first three letters and a 6 digit number that should be unique.

    You can just use that function in the Update property of the form field. If yo want the user to see it you can put the same formula in the Default property

  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @JimboSey 

    @BrianS has a point that two users might be creating items at the same time which would may cause an issue in a high volume environment.

    Please let me know which way you want to go - if you want to use a Flow I will provide an example.

     

     

  • JimboSey Profile Picture
    321 on at

    I would like to try using Flow please as it will be low traffic

  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @JimboSey 

    Here is an example of a Flow that you might use.  Pass in the Department name to the Flow.  It will return the prefix as well as the number to you.  The number will be 4 wide with leading zeros.

    image.pngimage.png

    image.png

    image.png

    image.png

  • JimboSey Profile Picture
    321 on at

    Thank you for this.

     

    I will try tomorrow and let you know, thanks again.

  • More2Learn Profile Picture
    46 on at

    I have a SP list that already has a Flow that generates a Unique ID Number based on user inputs into the SP List in Teams.  I am rolling out a Power App that will allow our users to complete a few additional things after an item has been placed in the log, so I have built a Power App that will let the users enter new items in the app instead of using the SP List.

     

    There is always a lag time for the Flow to run after the user has enter the new items for the ID to generate, so I have a Generating ID loop established in the Flow.  Now when I have the users do the same thing in Power Apps, how do I return/call the new ID number after the item is submitted to the SP List from the Power Apps Form?

     

    What I'd like to have happen is that when the User clicks a Submit button on the form submitting the information to the SP List that a Pop Up appear on their screen telling them the new ID Number, I'm just not sure how to make that happen.

     

    Thanks in advance for any advice you can offer.

  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    You can have the Flow return the ID to PowerApps. As in the previous answer you just return the number in the Respond to PowerApps  step. You can add whatever info yo want in that step

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard