[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Line", 'OnAfterInitItemLedgEntry', '', true, true)] procedure MyProcedure2(ItemJournalLine: Record "Item Journal Line"; var NewItemLedgEntry: Record "Item Ledger Entry") var begin if NewItemLedgEntry.Positive = true then NewItemLedgEntry."Carat Wt" := ItemJournalLine."Carat Wt" else if NewItemLedgEntry.Positive = false then NewItemLedgEntry."Carat Wt" := (ItemJournalLine."Carat Wt") * -1; end;
Answers
2. The structure of your code is not really clear. I would propose something like: