[EventRequest] CopyFromTransferLine in Codeunit 5856 "TransferOrder-Post Transfer" and table 5857 "Direct Trans. Line"
In codeunits 5704 "TransferOrder-Post Shipment" and 5705 "TransferOrder-Post Receipt", when the line is transfered from the Transfer Order Line (functions InsertTransShptLine and InsertTransRcptLine), the event CopyFromTransferLine of the destination tables is used to copy the fields, and into these table events there are the OnAfterCopyFromTransferLine.
The same behaviour must be used in the codeunit 5856 "TransferOrder-Post Transfer". The InsertDirectTransLine function doesn't use any event from the table 5857 "Direct Trans. Line". It should use a function CopyFromTransferLine from the table to transfer the fields, and this function must have the OnAfterCopyFromTransferLine IntegrationEvent.
Hi,
Please always put the full detailed signature of the requested events and the parameters passed in the call. You help us implementing the requests faster when your request contains AL code copied from VSCode instead of screenshots. Please put the code surrounding the place, where you expect a new event call, as a text not as a screenshot.
In the function InsertDirectTransLine of the codeunit 5856 "TransferOrder-Post Transfer" it should transfer the fields using a function CopyFromTransferLine from the destination table (5857 "Direct Trans. Line"), like similar codeunits (5704 "TransferOrder-Post Shipment" and 5705 "TransferOrder-Post Receipt").
Then, at the end of the new function CopyFromTransferLine the integration event OnAfterCopyFromTransferLine(var DirectTransLine: Record "Direct Trans. Line"; TransferLine: Record "Transfer Line") must be created.
Could you please provide needed code update like this: https://github.com/microsoft/ALAppExtensions/issues/16893 It will help to consider some details which could be important for you.
Codeunit 5856 "TransferOrder-Post Transfer" must be changed like this:
local procedure InsertDirectTransLine(DirectTransHeader: Record "Direct Trans. Header"; TransLine: Record "Transfer Line")
begin
OnBeforeInsertDirectTransLine(TransLine);
DirectTransLine.Init();
DirectTransLine."Document No." := DirectTransHeader."No.";
DirectTransLine.CopyFromTransferLine(TransLine);
if TransLine.Quantity > 0 then begin
New integration event:
[IntegrationEvent(false, false)]
local procedure OnBeforeInsertDirectTransLine(TransLine: Record "Transfer Line")
begin
end;
Then all the transferred fields shoud be done in new function CopyFromTransferLine of the table 5857 "Direct Trans. Line":
procedure CopyFromTransferLine(TransLine: Record "Transfer Line")
begin
"Line No." := TransLine."Line No.";
"Item No." := TransLine."Item No.";
Description := TransLine.Description;
Quantity := TransLine."Qty. to Ship";
"Unit of Measure" := TransLine."Unit of Measure";
"Shortcut Dimension 1 Code" := TransLine."Shortcut Dimension 1 Code";
"Shortcut Dimension 2 Code" := TransLine."Shortcut Dimension 2 Code";
"Dimension Set ID" := TransLine."Dimension Set ID";
"Gen. Prod. Posting Group" := TransLine."Gen. Prod. Posting Group";
"Inventory Posting Group" := TransLine."Inventory Posting Group";
DirectTnsLine.Quantity := TransLine.Quantity;
"Quantity (Base)" := TransLine."Quantity (Base)";
"Qty. per Unit of Measure" := TransLine."Qty. per Unit of Measure";
"Unit of Measure Code" := TransLine."Unit of Measure Code";
"Gross Weight" := TransLine."Gross Weight";
"Net Weight" := TransLine."Net Weight";
"Unit Volume" := TransLine."Unit Volume";
"Variant Code" := TransLine."Variant Code";
"Units per Parcel" := TransLine."Units per Parcel";
"Description 2" := TransLine."Description 2";
"Transfer Order No." := TransLine."Document No.";
"Transfer-from Code" := TransLine."Transfer-from Code";
"Transfer-to Code" := TransLine."Transfer-to Code";
"Transfer-from Bin Code" := TransLine."Transfer-from Bin Code";
"Item Category Code" := TransLine."Item Category Code";
OnAfterCopyFromTransferLine(Rec, TransLine);
end;
[IntegrationEvent(false, false)]
local procedure OnAfterCopyFromTransferLine(var DirectTransLine: Record "Direct Trans. Line"; TransferLine: Record "Transfer Line")
begin
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.