Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Create UniqueID

(0) ShareShare
ReportReport
Posted on by 4,682 Super User 2025 Season 1

I'd like to create a formula that auto-generates a UniqueID.

 

I have an app that opens to a new Form. The form is connected to an SPList/Collection.

I've been manually filling the SPList 'Title' column with sequential numbers, starting at 1; there are currently 8.

I want to keep using the content of this column; in the PA Form I have included the 'Title' column (Visible: false).

I am trying to write a formula that says return to this Form Datacard field the LAST number in the SPList 'Title' column +1.

This will happen for each new form and be used as the UniqueID for each item. I will use this number in any 'Updates' to the list specific to Gallery items.

Categories:
  • agorkemt Profile Picture
    71 on at
    Re: Create UniqueID

    the best answer ever! everyone knows a lot, but not everyone gives the straight and easy solution like this answer! Guid() and no need to invent everything from the start! Thanks @mdevaney 

    Have been searching the web for this solution and even i changed the data type of the ID columns in the Database to match the other solutions like includes lots of functions and labyrinths etc etc. but hey Guid() and that's all. 

  • PaulD1 Profile Picture
    2,914 on at
    Re: Create UniqueID

    I would recommend Patch (can modify just the specified fields) rather than Update (replaces whole record). You need a second argument which specifies the record you are trying to update (often a LookUp statement) in your Patch.

    I am not sure why you are trying to save the ID into the Title field. I would just use the existing ID field. If title is mandatory, set it to a dummy value and hide it in your list and in your App.

  • Phineas Profile Picture
    4,682 Super User 2025 Season 1 on at
    Re: Create UniqueID

    Before I try it...does this look right?

    Also, this is and 'Edit' form, should the formula be Patch or Update?


    Patch(
    HDProofOfConceptList,
    {Title: Value(ID_DataCard1.Default), <---This is the SPList ID
    MainTopic: DataCardValue1_2.Selected.Value,
    EmployeeName: DataCardValue2_2.Text,
    EmployeeEmail: DataCardValue5_2.Text,
    DateOfRequest: DataCardValue10_2.SelectedDate,
    ResponseDueDate: DataCardValue9_1.SelectedDate,
    RequestStatus: DataCardValue8_2.Selected,
    SupervisorName: DataCardValue4_2.Text,
    SupervisorEmail: DataCardValue6_2.Text,
    Department: DataCardValue3_2.Text,
    Notes: RichTextEditor7.HtmlText});

  • PaulD1 Profile Picture
    2,914 on at
    Re: Create UniqueID

    SharePoint lists have their own ID field which is an auto generated sequential number, so I would suggest simply using that. Note though that if a record is deleted, the ID number will not be re-used so you may get gaps in your sequence.

    That said, with a nerdy-technical-data-modelling hat on, the ID number should just be a unique reference for the record and should not hold any other 'meaning' (such as where the record exists within a sequence of records). You should put anything meaningful in other fields and/or run appropriate queries (e.g. if you want to know how many records between the start and end of month, run a query to count them, don't get the first and the last and find the difference in ID numbers).

    Of course, the ability to run queries in SharePoint (or Dataverse) is limited which is where you must consider whether SharePoint will satisfy your requirements. You want to use a 'real' relational database as your datasource, though that puts you on the wrong side of premium licensing when using Power Apps for your UI.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at
    Re: Create UniqueID

    @Phineas 

    You don't have to create one. SharePoint automatically assigns one to each new record. It is sequential and cannot be reused if the record is deleted. 

  • Phineas Profile Picture
    4,682 Super User 2025 Season 1 on at
    Re: Create UniqueID

    I entered GUID() in the Default of the 'Title' Datacard (DatacardValue1).

    I added the 'Title' Datacard (DatacardValue1) to the Update of the Submit button.

    Patch(
    HDProofOfConceptList,
    {Title: DataCardValue1.Text,
    MainTopic: DataCardValue1_2.Selected.Value,
    EmployeeName: DataCardValue2_2.Text,
    EmployeeEmail: DataCardValue5_2.Text,
    DateOfRequest: DataCardValue10_2.SelectedDate,
    ResponseDueDate: DataCardValue9_1.SelectedDate,
    RequestStatus: DataCardValue8_2.Selected,
    SupervisorName: DataCardValue4_2.Text,
    SupervisorEmail: DataCardValue6_2.Text,
    Department: DataCardValue3_2.Text,
    Notes: RichTextEditor7.HtmlText});

    SharePoint List kicked back an error. The 'Title' column is "required", and should have been populated by the new GUID from the PA Patch.

     

    Line 11 is the last 'existing' entry, the next was my test attempt.

    No GUID came through with the data, though the other data did populate the appropriate fields.

    Phineas_1-1648519213071.png

     

     

     

    Phineas_0-1648518956023.png

     

  • mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on at
    Re: Create UniqueID

    @Phineas 
    I'd suggest using the GUID function instead.  The GUID function creates a unique identifier that you can patch to the title column.  The benefit is you don't have worry about creating this sequence of numbers.  You can literally just type the code GUID() and you're done!

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving 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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard