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 Unique ID on ...
Power Apps
Unanswered

Generate Unique ID on PowerApps

(0) ShareShare
ReportReport
Posted on by 12

I would like to generate Unique ID from Powerapps on every new item creation. Right now I am using the below code but I did not find the way to do it, Any help would be appreciated.

 

I have a dropdown which is "DataCardValue80", I need to have the prefix defined based on dropdown selection software "s- "or Infrastructure "I-" in the textbox with unique ID generation 

 

Ex: 1. S-01

     2. I-02

 

If((DataCardValue80.Selected.Value="Software"),"S-",(DataCardValue80.Selected.Value = "Infrastructure"),"I-" && First(Sort('SPList','No.')).'No.'+ 1)

 

Categories:
I have the same question (0)
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @nikhilprakash8 

    Please try the following,

    With({varNo:First(Sort('SPList','No.')).'No.'},
    	Switch(DataCardValue80.Selected.Value,
    			"Software", "S-",
    			"Infrastructure", "I-"	
    	) & Text(varNo+1)
    )

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

  • nikhilprakash8 Profile Picture
    12 on at

    @CNT It does work but when dropdown is blank it shows 1. As I was thinking to the textbox blank.

     

    Second, On every new record or new item creation it want to have new IDs like First item S-1, second item S-2. But with the above code on every new item creation it shows S-1 or I-1

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @nikhilprakash8 Can you share the code you have for creating a new record.

  • nikhilprakash8 Profile Picture
    12 on at

    @CNT Navigate('Create New Request') and I have dropdown ("","Software","Infra"), then based the dropdown selection I need to have unique Id in textbox with prefix S- and I-, when dropdown is blank textbox should be blank. 

     

    I have used If((DataCardValue80.Selected.Value="Software"),Right(Text(Rand()*3),2)&"-"&Right(Text(Rand()*3),3),(DataCardValue80.Selected.Value = "Infrastructure"),Right(Text(Rand()*3),2)&"-"&Right(Text(Rand()*3),3))

     

    But still no result. I have save button "SubmitForm(Form4)"

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 860

#2
Valantis Profile Picture

Valantis 548

#3
Haque Profile Picture

Haque 417

Last 30 days Overall leaderboard