Hi All,
I'm trying to update a new field in sales line table with description 2 from item table (when the order is released) ..I could get a header field on lines but not from item table. here's the code, need tips on how to link a third table such as Item or customer.
EventSubscriberInstance = StaticAutomatic;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Release Sales Document", 'OnBeforeManualReleaseSalesDoc', '', true, true)]
local procedure MyProcedure(var SalesHeader: Record "Sales Header")
var
RecItem: Record Item;
SalesLine: Record "Sales Line";
begin
SalesLine.RESET;
SalesLine.SETRANGE("Document Type", SalesHeader."Document Type");
SalesLine.SETRANGE("Document No.", SalesHeader."No.");
SalesLine.SETRANGE("No.", RecItem."No.");
IF SalesLine.FindSet() THEN
REPEAT
SalesLine.MyDescription := RecItem."Description 2";
SalesLine.MODIFY(TRUE);
UNTIL SalesLine.NEXT = 0;
End;