[Event Request] Codeunit 80 "Sales-Post" - Job entries
Why do you need this change?
We would like to request new integration events in the Sales-Post codeunit, which concerns job related operations. As this check is executed for every line being posted, the overhead for bulk operations is incredibly high, even though the functionality is not in use by any of our customers. To improve performance during our bulk posting operations, the events will be subscribed using manual subscription to skip these costly executions for each line.
Describe the request
Object: codeunit 80 "Sales-Post" Procedure: ArchiveRelatedJob
Code:
#if NEWEVENTS
[IntegrationEvent(false, false)]
local procedure OnBeforeArchiveRelatedJob(SalesHeader: Record "Sales Header"; var IsHandled: Boolean)
begin
end;
#endif
local procedure ArchiveRelatedJob(SalesHeader: Record "Sales Header")
var
Job: Record Job;
SalesLine: Record "Sales Line";
JobArchiveManagement: Codeunit "Job Archive Management";
#if NEWEVENTS
IsHandled: Boolean;
begin
OnBeforeArchiveRelatedJob(SalesHeader, IsHandled);
if IsHandled then
exit;
#endif
SalesLine.SetRange("Document Type", SalesHeader."Document Type");
SalesLine.SetRange("Document No.", SalesHeader."No.");
SalesLine.SetFilter("Job No.", '<>%1', '');
if not SalesLine.FindFirst() then
exit;
if Job.Get(SalesLine."Job No.") then
JobArchiveManagement.AutoArchiveJob(Job);
end;
Internal work item: AB#610440
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: 41916.