Increment a key field in a table

I created a new table with a Key data type = integer.

I would like this field be incremented since is create a new record. How can I do It?

I nedd something like Entry No. field from table 21 (Cust. Ledger Entry)

Thanks

You can add code to the OnInsert trigger. Create a variable that refers to the same table. If you can find any records in the table then the new entry number should be the last entry number plus one. If you cannot find any records in the table then the entry number should be one.

There are several places within Codeunit 12 that use this sort of coding. I just prefer to do it in the OnInsert trigger myself.

You could also look into the AutoIncrement property, but it’s not how Customer Ledger Entry does it.

I hope AutoIncrement Property fits you…

Where can I find AutoIncrement Property?

Sorry, I was Blind…I found it

Is autoincrement property suitable for your requiremnet?

if yes close the thread

Thanks, this was a solution for my question.

Welcome [:)]

Thank U