Passing field from Production Journal to ILE - Onbefore or OnAFter trigger

samantha73samantha73 Member Posts: 88
Hi All
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:
OnBeforeInsertOutputJnlLine
OnAfterInsertOutputJnlLine

However I'm not sure whether using one is better than the other. In what scenarios would you use OnAfter vs OnBefore?
Thanks

Best Answer

  • Developer101Developer101 Member Posts: 509
    Answer ✓
    I think this should be easy one

    OnBeforeInsertOutputJnlLine(ItemJnlLine, ProdOrderRtngLine, ProdOrderLine);
    ItemJnlLine.Insert();
    OnAfterInsertOutputJnlLine(ItemJnlLine);


    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
    United Kingdom

Answers

  • Developer101Developer101 Member Posts: 509
    Answer ✓
    I think this should be easy one

    OnBeforeInsertOutputJnlLine(ItemJnlLine, ProdOrderRtngLine, ProdOrderLine);
    ItemJnlLine.Insert();
    OnAfterInsertOutputJnlLine(ItemJnlLine);


    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
    United Kingdom
Sign In or Register to comment.