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 Platform Community / Forums / Power Apps / Dataverse id column
Power Apps
Unanswered

Dataverse id column

(0) ShareShare
ReportReport
Posted on by 53

Hello,

 

I have a problem with the allocation of the unique ID in the Dataverse. I tested two options:

 

1. The ID column is set to Text and while the new record is added it's working throught the following function:

 

Patch(Aufgaben; Defaults(Aufgaben); {cr123_id:First(Sort(Aufgaben;cr4f5_id;Descending)).cr4f5_id+1}; the rest of the to be patched fields)

 

In this case I am able to add only 10 records with uniqe ID number. After 10 records the function First(Sort(Aufgaben;cr4f5_id;Descending)).cr4f5_id shows always that the last record has ID 9. All new records will be saved with the ID number 10. So nevermind how many records I will add, it will always be saved with ID number 10. 

 

2. The ID column is set to autonumber. The field is set to optional. I am patching with the patch function and no cr123_id field inside. All new records will be patched with double id numbers. So now I have two records with id number 1, two records with id number 2, two records with id number 3, etc.

 

What is the problem over here? In the whole application I am using text format for the id columns in all other tables and the function {cr123_id:First(Sort(Aufgaben;cr4f5_id;Descending)).cr4f5_id+1} is working on all other tables except the table Aufgaben.

I have the same question (0)
  • maskwer Profile Picture
    53 on at

    Okay so I managed to do some small workaround and used ClearCollect to collect the table (otherwise you get delegation warning) and the function Max(colTable; id) +1 to get the max number from the id field and set the new one +1. 

     

    I still don't understand why the autonumber doesn't function properly "out of the box". Is it normal?

  • Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    HI @maskwer ,

     

    Utilizing autonumber, you should not set this field at all in your patch.  Make sure the field is setup as "Not Required" in the Dataverse and the field will be set by Dataverse utilizing the pattern identified when you configured the autonumber field when you add a record.  You do not need to to the Max(...) + 1 type of logic. 

     

    Hope this helps.  Please accept if answers your question or Like if helps in any way.


    Thanks,


    Drew

  • Ram Prakash Duraisamy Profile Picture
    5,593 Super User 2025 Season 2 on at

    Hello @maskwer,

     

    1. If you are using text field then you are good to go with cr4f5_id+1 and you can patch the same too.

    2. If you are using Auto Number Field then you don't want to worry about setting the field using Patch Function try setting the AutoNumber field in the Dataverse Table Level.

     

    1. Go to https://make.powerapps.com

    2. Click On DataVerse

    3. Click On Tables

    4. Expand Table and Click Aufgaben

    5. Click On Fields 

    6. Open the Auto Number Fields then set the Auto Number Type

    rampprakash_0-1636299397374.png

     

    rampprakash_1-1636299445779.png

     

    then you can input Seed too to proceed the same.

     

     

    Please mark as Answer if it is helpful and provide Kudos


    Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
    Blog : https://microsoftcrmtechie.blogspot.com

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard