I want to pass a field (new field) from the production journal output line to item ledger entry table. I found a codeunit in base app(Production Journal Mgt.) where I can use one of the below integration events:
However I'm not sure whether using one is better than the other. In what scenarios would you use OnAfter vs OnBefore?
OnBeforeInsertOutputJnlLine(ItemJnlLine, ProdOrderRtngLine, ProdOrderLine);
I would use OnBeforeInsertOutputJnlLine if I still need to assign a value to a field in the Item Journal Line before ItemJnlLine.Insert is called.
I would use OnAfterInsertOutputJnlLine when all the values been assigned to Item Journal Line and Insert has been called.
Looking at your scenario, you might have to use OnBeforeInsertOutputJnlLine