Quantity in Purchase Lines

I created a new field in purchase lines, caled box.

When user fill Box field with 10, for exemple, the field quantity automatically is filled with 170 (10*17).

But with this, the Quantity to received, and quantity to invoice are empty, they are not automaticaly filled by system.

How can I do It, to be filled automatically


I think you have to take a look also field’s trigger to design your solution.


Can you help me more??

On the OnValidate trigger of your new field, write following code:


and then try, it should work.

That for different UoMs exist:

  1. define PCS as base UoM having Qty=1
  2. add whatever other UoMs you need, in this certain case, add BOX with Qty per UoM = 17
  3. if something like PALETTE is added, Qty must be in base UoM - if there are 10 BOXes per palette, Qty will be 170 PCS, not 10 BOXes.

All this can be found on Item Card under Base Unit of Measure.

Further on, you can define Sales UoM and Purchase UoM to fill in automatically the UoM if you always (or mostly) buy in PALETTEs and sell in BOXes or PCS.

All the above are defined per Item, so no problems arise if other items are boxed by 12 or 20 etc etc.

As above, why aren’t you using the unit of measure functionality already built into the system?

try override modified method in both field and call super() in the method.


What is PCS??

The problem is that customer works with Boxes. And each box has 17 Kg’s.

So customer only counts boxes, so I created a new field Box, and when customer puts 10 boxes for exemple, Quantity field is 170 KG’s.

In this situation, the quantity field is not filled manualy but automaticaly, and so the problem, the other fields are empty, Quantity to Receive, Quantity to Invoice, …

PCS is unit of measure…Pieces

For your this case, you should use Unit of Measure functionality of Navision.

In Item Card, you can define differnet Base Unit of Measure, Sales Unit of Measure & Purch. Unit of Measure.

And in Item Unit of Measure form, you can define the relationship between various units for example, 1 Box= 17 PCS

Thanks Dhan, for your solution.


I still do not understand WHY you added that custom field, if Navision has standart functionality that covers your needs…

Reread this thread - all of us answering pointed out the “normal” Navision way of solving the case.

Now, I know that I have Both Solutions.

But you are right, the Navision standard functionality must be our firs choice.

Thanks for the advice