how to add an auto increatement ID on sales order list at the first column ?

Hi experts.

I don’t know if you are got such request?

our customer wants to add a new column at the 1st column which is auto increment in sales order list ? And don’t need to save a new field in table, just need to show it on the page.

Any suggestion will be warmly appreciated.



I think you need to create a new field in the table and then add it to the page and you can set the properties of the page to autoincrement to “Yes” and also Autospiltkey “Yes”, so that for every line of the sales order list get incremented automatically.

For example:

10000 - for the first line

20000- for the second line and it goes on.

Please mark it as verified if it resolves your issue.


Bharath K

Hi Bharath, thanks for your reply, i know this point, But our customer just want to know how many records for this filter , For example, if after set the filter for sales order list, and we get 5 records, we hope the 1st column shows : 1, 2,3,4,5, not the other number,So i could not put it on table, because it will not be adjustment, when changed the order of the column.

The easy way is to declare an integer variable in the list page. Set it to 0 OnInitRec, and then add +1 in the OnAfterGetRecord trigger.
But depending on the key and your filters, then you might end up with an incorrect number.

The better (and more correct/difficult way) would be to use OnNextRecord, but then you need a lot more code to manage the page.

Hi Erik, Thanks for you reply, yup , the 1st way, i have tried, after changed the default sort, the number changed to be incorrect, I want to use onNextRecord, But no experice on this function, could you guide me a lot? thanks in advance.