microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
770 stars 610 forks source link

[Event Request change] page 6510 "Item Tracking Lines" - OnRegisterChangeOnAfterModify #14575

Closed Duizy1971 closed 2 years ago

Duizy1971 commented 2 years ago

We are missing the orginal OldTrackingSpecification values when using the event OnRegisterChangeOnAfterModify. It would be very nice to add a new local variable OriginalOldTrackingSpecification: Record "Tracking Specification" in procedure RegisterChange and set the value in the ChangeType::Modify case option:

protected procedure RegisterChange(var OldTrackingSpecification: Record "Tracking Specification"; var NewTrackingSpecification: Record "Tracking Specification"; ChangeType: Option Insert,Modify,FullDelete,PartDelete,ModifyAll; ModifySharedFields: Boolean) OK: Boolean
var
    ReservEntry1: Record "Reservation Entry";
    ReservEntry2: Record "Reservation Entry";
    OriginalOldTrackingSpecification: Record "Tracking Specification"; //A200F0000.Event
    CreateReservEntry: Codeunit "Create Reserv. Entry";
    ...
        ChangeType::Modify:
            begin
                OriginalOldTrackingSpecification := OldTrackingSpecification; //A200F0000.Event
                ReservEntry1.TransferFields(OldTrackingSpecification);
                ReservEntry2.TransferFields(NewTrackingSpecification);
                ....
                    TempReservEntry.ClearTrackingFilter();
                    RegisterChange(
                        NewTrackingSpecification, NewTrackingSpecification, ChangeType::PartDelete, not IdenticalArray[2]);
                end;
                //OnRegisterChangeOnAfterModify(NewTrackingSpecification, OldTrackingSpecification, CurrentPageIsOpen); A200F0000.Event18.05.o
                OnRegisterChangeOnAfterModify(NewTrackingSpecification, OldTrackingSpecification, OriginalOldTrackingSpecification, CurrentPageIsOpen); //A200F0000.Event.n
                OK := true;
            end;
        ChangeType::FullDelete,

Event Signature:

[IntegrationEvent(false, false)]
local procedure OnRegisterChangeOnAfterModify(var NewTrackingSpecification: Record "Tracking Specification"; var OldTrackingSpecification: Record "Tracking Specification"; var OriginalOldTrackingSpecification: Record "Tracking Specification"; CurrentPageIsOpen: Boolean)
begin
    //A200F0000.Event parameter OriginalOldTrackingSpecification and CurrentPageIsOpen
end;
JesperSchulz commented 2 years ago

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.