Why do you need this change?
At 4PS Construct, we need access to the current Item Journal Line context in the before-insert value entry events that are raised during transfer, variance, and correction posting flows in codeunit 22 "Item Jnl.-Post Line".
In our extension scenarios, custom logic needs to inspect fields from ItemJnlLine such as document context, source information, job fields, dimension-related data, and entry-specific posting characteristics before deciding how to handle the value entry that is about to be inserted.
There are five events that are called before inserting value entry. The events OnItemValuePostingOnBeforeInsertValueEntry and OnInsertTransferEntryOnBeforeInsertValueEntry already exposes ItemJournalLine, but the OnInsertVarValueEntryOnBeforeInsertValueEntry, OnInsertTransferEntryOnBeforeInsertValueEntry, OnInsertCorrValueEntryOnBeforeInsert do not. These three events were added here #29649.
To support consistent and upgrade-safe extensibility, we need ItemJournalLine to be available on these before-insert value entry events as well.
Describe the request
On behalf of 4PS, I would like to request that ItemJournalLine is exposed on the before-insert value entry events in codeunit 22 "Item Jnl.-Post Line" so extensions can apply the same line-based logic across transfer, variance, and correction value entry scenarios.
Current integration events and suggested versions:
- OnInsertVarValueEntryOnBeforeInsertValueEntry
Current version:
[IntegrationEvent(false, false)]
local procedure OnInsertVarValueEntryOnBeforeInsertValueEntry(var ValueEntry: Record "Value Entry"; var GlobalItemLedgerEntry: Record "Item Ledger Entry"; var IsHandled: Boolean)
begin
end;
Suggested version:
[IntegrationEvent(false, false)]
local procedure OnInsertVarValueEntryOnBeforeInsertValueEntry(var ValueEntry: Record "Value Entry"; var GlobalItemLedgerEntry: Record "Item Ledger Entry"; ItemJournalLine: Record "Item Journal Line"; var IsHandled: Boolean)
begin
end;
Relevant usage point:
ValueEntry."Cost per Unit" :=
CalcCostPerUnit(ValueEntry."Cost Amount (Actual)", ValueEntry."Valued Quantity", false);
ValueEntry."Cost per Unit (ACY)" :=
CalcCostPerUnit(ValueEntry."Cost Amount (Actual) (ACY)", ValueEntry."Valued Quantity", true);
IsHandled := false;
OnInsertVarValueEntryOnBeforeInsertValueEntry(ValueEntry, GlobalItemLedgEntry, ItemJnlLine, IsHandled);
if IsHandled then
exit;
InsertValueEntry(ValueEntry, GlobalItemLedgEntry, false);
- OnInsertTransferEntryOnBeforeInsertValueEntry
Current version:
[IntegrationEvent(false, false)]
local procedure OnInsertTransferEntryOnBeforeInsertValueEntry(var NewValueEntry: Record "Value Entry"; var NewItemLedgerEntry: Record "Item Ledger Entry"; ItemJournalLine: Record "Item Journal Line"; var ValueEntryNo: Integer; var IsHandled: Boolean)
begin
end;
Suggested version:
[IntegrationEvent(false, false)]
local procedure OnInsertTransferEntryOnBeforeInsertValueEntry(var NewValueEntry: Record "Value Entry"; var NewItemLedgerEntry: Record "Item Ledger Entry"; ItemJournalLine: Record "Item Journal Line"; var ValueEntryNo: Integer; var IsHandled: Boolean)
begin
end;
Relevant usage point:
ApplyItemLedgEntry(NewItemLedgEntry, ItemLedgEntry2, NewValueEntry, true);
AutoTrack(NewItemLedgEntry, IsReserved);
OnBeforeInsertTransferEntry(NewItemLedgEntry, OldItemLedgEntry, ItemJnlLine);
InsertItemLedgEntry(NewItemLedgEntry, true);
IsHandled := false;
OnInsertTransferEntryOnBeforeInsertValueEntry(NewValueEntry, NewItemLedgEntry, ItemJnlLine, ValueEntryNo, IsHandled);
if not IsHandled then begin
InsertValueEntry(NewValueEntry, NewItemLedgEntry, true);
UpdateUnitCost(NewValueEntry);
end;
xValueEntryNo := ValueEntryNo;
OnAfterInsertTransferEntry(ItemJnlLine, NewItemLedgEntry, OldItemLedgEntry, NewValueEntry, ValueEntryNo);
ValidateSequenceNo(ValueEntryNo, xValueEntryNo, Database::"Value Entry");
end;
- OnInsertCorrValueEntryOnBeforeInsert
Current version:
[IntegrationEvent(false, false)]
local procedure OnInsertCorrValueEntryOnBeforeInsert(var NewValueEntry: Record "Value Entry"; var ItemLedgerEntry: Record "Item Ledger Entry"; var ShouldInsertValueEntry: Boolean)
begin
end;
Suggested version:
[IntegrationEvent(false, false)]
local procedure OnInsertCorrValueEntryOnBeforeInsert(var NewValueEntry: Record "Value Entry"; var ItemLedgerEntry: Record "Item Ledger Entry"; ItemJournalLine: Record "Item Journal Line"; var ShouldInsertValueEntry: Boolean)
begin
end;
Relevant usage point:
PostInventoryToGL(NewValueEntry);
InsertItemReg(0, 0, NewValueEntry."Entry No.", 0);
NewValueEntry."Item Register No." := ItemReg."No.";
ShouldInsertValueEntry := true;
OnInsertCorrValueEntryOnBeforeInsert(NewValueEntry, ItemLedgEntry, ItemJnlLine, ShouldInsertValueEntry);
if not ShouldInsertValueEntry then
exit;
NewValueEntry.Insert(true);
xValueEntryNo := ValueEntryNo;
OnAfterInsertCorrValueEntry(NewValueEntry, ItemJnlLine, ItemLedgEntry, ValueEntryNo);
ValidateSequenceNo(ValueEntryNo, xValueEntryNo, Database::"Value Entry");
ItemApplnEntry.SetOutboundsNotUpdated(ItemLedgEntry);
UpdateAdjmtProperties(NewValueEntry, ItemLedgEntry."Posting Date");
InsertPostValueEntryToGL(NewValueEntry);
Internal work item: AB#639952
Why do you need this change?
At 4PS Construct, we need access to the current Item Journal Line context in the before-insert value entry events that are raised during transfer, variance, and correction posting flows in codeunit 22 "Item Jnl.-Post Line".
In our extension scenarios, custom logic needs to inspect fields from ItemJnlLine such as document context, source information, job fields, dimension-related data, and entry-specific posting characteristics before deciding how to handle the value entry that is about to be inserted.
There are five events that are called before inserting value entry. The events OnItemValuePostingOnBeforeInsertValueEntry and OnInsertTransferEntryOnBeforeInsertValueEntry already exposes ItemJournalLine, but the OnInsertVarValueEntryOnBeforeInsertValueEntry, OnInsertTransferEntryOnBeforeInsertValueEntry, OnInsertCorrValueEntryOnBeforeInsert do not. These three events were added here #29649.
To support consistent and upgrade-safe extensibility, we need ItemJournalLine to be available on these before-insert value entry events as well.
Describe the request
On behalf of 4PS, I would like to request that ItemJournalLine is exposed on the before-insert value entry events in codeunit 22 "Item Jnl.-Post Line" so extensions can apply the same line-based logic across transfer, variance, and correction value entry scenarios.
Current integration events and suggested versions:
Current version:
Suggested version:
Relevant usage point:
Current version:
Suggested version:
Relevant usage point:
Current version:
Suggested version:
Relevant usage point:
Internal work item: AB#639952