I have extended an Item Table and Item Card Page with an Integer type field called Purchase Price.
I have to have this be shown on Subform of Sales Order. I added the field on the Subform after extending Sales Line table with the same field Purchase Price and have written the code;
trigger OnValidate()
var
ItemContainer: Record Item;
begin
IF ItemContainer.GET(Rec."No.") then BEGIN
"Purchase Price" := ItemContainer."Purchase Price";
ItemContainer.Modify();
END;
end;
Once at the subform I select this item, I want to just how Description and other fields get filled automatically; to get Purchase Price get populated as well. Right now only when the Purchase Price field is validated it brings in the value or else shows 0.
What trigger can I write the code in so that once an Item is selected by the user at Subform, just how other item related fields are filled automatically in one go, so does my Purchase Price?
Answers
2. Sales Line column "No.".OnValidate trigger should do that job.