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)
@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)"
@nikhilprakash8 Can you share the code you have for creating a new record.
@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
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.
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2