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.
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
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
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
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?
ankit_singhal
11
Super User 2025 Season 1
stampcoin
9
mmbr1606
9
Super User 2025 Season 1