Investigating SalesLineIdx / PurchLineIdx AX2009

I’m going to talk about the SalesLineIdx inside SalesLine table.

SalesLineIdx contains: “AllowDuplicates: No

  1. DataField: SalesId
  2. DataField: LineNum
  3. DataField: RecId

It means duplicated lines for the same Sales order(SalesId) are accepted.
I know that SalesLine.LineNum wont be duplicated, but lets say that someone customized something and he did not consider the whole idea of LineNum “It easily happens, why not!”

Let’s take a loot at “STANDARD SYS AX” find() method inside SalesLine table:
static SalesLine find(SalesId salesId,
LineNum lineNum = 0,
boolean update = false)

Since LineNum is not unique, how is this LineNum has been set as a parameter to return a unique record?
Just to let you know friends, I’m not looking for a solution. Looking for opinions indeed.

SaleLineIdx is an unique index - it will not allow the duplicate values. But as index is a cimbination fo three you can have same line number.

These things need to be considered when doing a customization.

In the find method lineNum is a default parmater. you may or may not be passing the value. If you dont pass any value it will return the first record.

Rather you can use the findInventTransId method to return a unique record.