microsoft / ALAppExtensions

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

[Event Request] deunit 5139 "Job Archive Management" - OnRestoreSingleJobPlanningLineOnBeforeInsertJobPlanningLine #26725

Closed pri-kise closed 3 months ago

pri-kise commented 3 months ago

Describe the request

Could you please add the following event?

local procedure RestoreJobPlanningLines(var JobTaskArchive: Record "Job Task Archive")
var
    JobPlanningLine: Record "Job Planning Line";
    JobPlanningLineArchive: Record "Job Planning Line Archive";
begin
    JobPlanningLineArchive.SetRange("Job No.", JobTaskArchive."Job No.");
    JobPlanningLineArchive.SetRange("Job Task No.", JobTaskArchive."Job Task No.");
    JobPlanningLineArchive.SetRange("Version No.", JobTaskArchive."Version No.");
    if JobPlanningLineArchive.FindSet() then
        repeat
            JobPlanningLine.Init();
            JobPlanningLine.TransferFields(JobPlanningLineArchive);
            OnRestoreSingleJobPlanningLineOnBeforeInsertJobPlanningLine(JobPlanningLineArchive, JobPlanningLine);
            JobPlanningLine.Insert(true);
            RecordLinkManagement.CopyLinks(JobPlanningLineArchive, JobPlanningLine);
            JobPlanningLine.Modify(true);
            OnAfterRestoreSingleJobPlanningLine(JobPlanningLineArchive, JobPlanningLine);
        until JobPlanningLineArchive.Next() = 0;
end;
[IntegrationEvent(false, false)]
local procedure OnRestoreSingleJobPlanningLineOnBeforeInsertJobPlanningLine(JobPlanningLineArchive: Record "Job Planning Line Archive"; var JobPlanningLine: Record "Job Planning Line")
begin
end;

Additional context

We would like to change some custom fields after the TransferFields before the Insert(true) is executed. Internal work item: AB#539233

JesperSchulz commented 3 months 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.

Build ID: 21464.