Adding a composite primary key
Based on what we have learned, we know that Dynamics NAV will automatically assign the first field on the table as the primary key when the table is created. In our case, Document No. will automatically be set as our primary key. However, just using Document No. as the primary key will not be enough to satisfy our requirement of allowing us to enter multiple lines. Don't believe me? Try entering two lines with the same document number.
So we need another field as part of the primary key. What do you think it should be?
That's right! The answer is to look at what existing functions Dynamics NAV already has. If you guessed anything else, go back to the previous chapter. Again, the function in Dynamics NAV that most resembles what we're trying to do is Sales Order
; more specifically, the Sales Line
table.
Go back and look at what the primary key for the
Sales Line
table is.We've already stated that Document Type is not needed for what we're trying to do. So that...