PurchHeader record is missing on OnBeforeSalesShptHeaderInsert event in Purch.-Post CodeUnit
In the Purch.-Post CodeUnit we trying to find an event for which we can modify the sales shipment header fields for shipping agent and service agent code based on attributes of the vendor that is shipping a drop ship purchase order.
However, the events below don't help us. For no good reason we can see the PurchHeader is missing on the first event, meaning we don't have access to change fields in the sales shipment header before it is inserted.
On the second event any changes to the SalesShptHeader record aren't persisted and we do not have permissions to call modify on that record in an event.
Whilst that data is also available on the sales shipment lines, these particular posted records unlike the salesline table to not container fields for the shipping agent and shipping agent service code.
Can we please add the PurchHeader to the OnBeforeSalesShptHeaderInsert event please.
local procedure InsertSalesShptHeader(var SalesOrderHeader: Record "Sales Header"; var PurchHeader: Record "Purchase Header"; var SalesShptHeader: Record "Sales Shipment Header")
begin
with SalesShptHeader do begin
Init;
TransferFields(SalesOrderHeader);
"No." := SalesOrderHeader."Shipping No.";
"Order No." := SalesOrderHeader."No.";
"Posting Date" := PurchHeader."Posting Date";
"Document Date" := PurchHeader."Document Date";
"No. Printed" := 0;
OnBeforeSalesShptHeaderInsert(SalesShptHeader, SalesOrderHeader, SuppressCommit);
Insert(true);
OnAfterSalesShptHeaderInsert(SalesShptHeader, SalesOrderHeader, SuppressCommit, PurchHeader);
end;
end;
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.