"Sales Line".Type := "Sales Line".Type::Item; "Sales Line".VALIDATE("No.",SKU);However this fails to execute the following code in the No. - OnValidate() trigger on the "Sales Line" table.
IF "No." <> xRec."No." THEN BEGIN IF Type = Type::Item THEN IF (Quantity <> 0) AND ItemExists(xRec."No.") THEN BEGIN ReserveSalesLine.VerifyChange(Rec,xRec); WhseValidateSourceLine.SalesLineVerifyChange(Rec,xRec); END; GetDefaultBin; AutoAsmToOrder; DeleteItemChargeAssgnt("Document Type","Document No.","Line No."); IF Type = Type::"Charge (Item)" THEN DeleteChargeChargeAssgnt("Document Type","Document No.","Line No."); END;This is because Xrec."No." is the same as Rec."No." when the trigger is called from an XMLport.
Comments
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
However, I am left with one problem.
The unit price on the sales line cannot be read directly from the import file. It will need to be calculated. This is because the import file layout includes a total line amount and a quantity but not a unit price. E.g. a quantity of 2 and a line amount of 200 needs to generate a unit price of 100 on the sales line table. The import file layout is not under my control.
So I will need to calculate the unit price and assign it to the "Sales Line"."Unit Price" field. I will then need the validation code on the "Unit Price" field to be executed (to correctly update the various line values) but I cant see how to do this without hitting my original problem again.
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
However, this one didn't seem to offer any help with my problem.
I thought your original post demonstrated that when you use VALIDATE in an XMLPort in the way shown in Example 1 then xRec and Rec will be the same.
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community