Skip to main content

Notifications

Community site session details

Community site session details

Session Id : HCPVGe6oJPPGtOqbWBvs9r
Power Apps - Microsoft Dataverse
Unanswered

Dataverse id column

Like (0) ShareShare
ReportReport
Posted on 6 Nov 2021 10:06:55 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.

  • Ram Prakash Profile Picture
    5,166 Super User 2025 Season 1 on 07 Nov 2021 at 15:38:39
    Re: Dataverse id column

    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

  • Drew Poggemann Profile Picture
    9,278 Most Valuable Professional on 06 Nov 2021 at 11:20:18
    Re: Dataverse id column

    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

  • maskwer Profile Picture
    53 on 06 Nov 2021 at 10:38:28
    Re: Dataverse id column

    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?

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Microsoft Dataverse

#1
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 9

#2
mmbr1606 Profile Picture

mmbr1606 9 Super User 2025 Season 1

Overall leaderboard

Featured topics