[Event Request] codeunit 99000845 "Reservation Management" - New event OnAutoTrackOnAfterGetItemSetup
Why do you need this change?
We would like to be able to utilize the AutoTrack functionality dynamically when certain conditions are fulfilled without having to set up the item to run AutoTrack all the time. Getting access to the global Item parameter through the new event, will allow us to set the Item."Order Tracking Policy" temporarily and thus invoke the AutoTrack functionality.
Describe the request
In codeunit 99000845 "Reservation Management" - procedure AutoTrack(TotalQty: Decimal) we would like a new integration event OnAutoTrackOnAfterGetItemSetup placed just after the call of GetItemSetup(CalcReservEntry). The event should expose the variables CalcReservEntry and Item as shown below.
procedure AutoTrack(TotalQty: Decimal)
var
SurplusEntry: Record "Reservation Entry";
DummyEntry: Record "Reservation Entry";
AvailabilityDate: Date;
QtyToTrack: Decimal;
ShouldExit: Boolean;
begin
CalcReservEntry.TestField("Source Type");
OnAutoTrackOnCheckSourceType(CalcReservEntry, ShouldExit);
if ShouldExit then
exit;
if CalcReservEntry."Source Type" = Database::"Item Journal Line" then
exit;
if CalcReservEntry."Item No." = '' then
exit;
GetItemSetup(CalcReservEntry);
//>>New Code Begin
OnAutoTrackOnAfterGetItemSetup(CalcReservEntry, Item);
//<<New Code End
if Item."Order Tracking Policy" = Item."Order Tracking Policy"::None then
exit;
CalcReservEntry.Lock();
QtyToTrack := CreateReservEntry.SignFactor(CalcReservEntry) * TotalQty - QuantityTracked(CalcReservEntry);
if QtyToTrack = 0 then begin
UpdateDating();
exit;
end;
QtyToTrack := MatchSurplus(CalcReservEntry, SurplusEntry, QtyToTrack, Positive, AvailabilityDate, Item."Order Tracking Policy");
// Make residual surplus record:
if QtyToTrack <> 0 then begin
if CurrentBindingIsSet then
MakeConnection(
CalcReservEntry, SurplusEntry, QtyToTrack, CalcReservEntry."Reservation Status"::Surplus, AvailabilityDate, CurrentBinding)
else
MakeConnection(
CalcReservEntry, SurplusEntry, QtyToTrack, CalcReservEntry."Reservation Status"::Surplus, AvailabilityDate, CalcReservEntry.Binding);
CreateReservEntry.GetLastEntry(SurplusEntry); // Get the surplus-entry just inserted
if SurplusEntry.IsResidualSurplus() then begin
SurplusEntry."Untracked Surplus" := true;
SurplusEntry.Modify();
end;
if Item."Order Tracking Policy" = Item."Order Tracking Policy"::"Tracking & Action Msg." then // Issue Action Message
IssueActionMessage(SurplusEntry, true, DummyEntry);
end else
UpdateDating();
end;
//>>New Code Begin
[IntegrationEvent(false, false)]
local procedure OnAutoTrackOnAfterGetItemSetup(var ReservationEntry: Record "Reservation Entry"; var Item: Record Item)
begin
end;
//>>New Code End
Internal work item: AB#613334
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.
Build ID: 43395.