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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

Create UniqueID

(0) ShareShare
ReportReport
Posted on by 5,325 Super User 2025 Season 2

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:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @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."

  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at

    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

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @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. 

  • PaulD1 Profile Picture
    2,914 on at

    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.

  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at

    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

    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.

  • agorkemt Profile Picture
    73 on at

    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. 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard