Copy Document on Puchase Order

On Purchase Line on Validate Quantity I created this code:



IF Type = Type::Item THEN

“ND Difference”:= Quantity * PurchasePayablesSetup.“AAA”;

If I create a new Purchase Oder the “ND Difference” Field is filled correctly.

But if i use Functions Button the Copy Document Option, I caal a Purchase Order Nº and after copy the “ND Difference” fiels becames empty.

Why all lines fields are copy correctly from the other Order Purchase line and this field “ND Difference” becames 0.000?


The way that I would approach this:

First I would debug the scenario in which the field is populated, so that I know what exactly causes the field to get a value.

Next, I would debug the scenario where the field is NOT populated, to figure out why that happens.

The difference between the two will give you the explanation of why. The next step is to come up with a way to fix it.

It probably has something to do with not validating the Quantity field when the copy doc function is run. The trick is though to determine why that is, because maybe that’s not always supposed to happen.