Skip to content

[W1][Codeunit][7312][Create Pick] Add integration event OnCreateWhseDocPlaceLineOnAfterAssignSourceDocument in procedure CreateWhseDocPlaceLine #30067

@mavohra

Description

@mavohra

Why do you need this change?

We need to intercept the warehouse activity line after its Source Document field has been assigned inside the CreateWhseDocPlaceLine repeat loop in Codeunit 7312 "Create Pick", and before TempWarehouseActivityLine.Delete() removes the temporary line. The goal is to allow a subscriber to modify fields on WarehouseActivityLine, such as overriding or supplementing the Source Document assignment based on a custom Whse. Document Type value that the standard exclusion filter does not account for.

The standard code assigns WarehouseActivityLine."Source Document" via WhseManagement.GetWhseActivSourceDocument only when the document type is not Internal Pick or Movement Worksheet. There is no way for a subscriber to extend the set of document types that should be excluded from this assignment, or to adjust any other WarehouseActivityLine field at this point after the source document is resolved and before the temporary line is deleted.

No event currently exists in this position inside the CreateWhseDocPlaceLine loop. The event OnCreateWhseDocPlaceLineOnAfterSetFilters fires before the loop starts at the filter setup stage and does not provide access to the fully initialized WarehouseActivityLine record. OnCreateWhseDocPlaceLineOnAfterTransferTempWhseActivLineToWhseActivLine fires earlier in the iteration before the source document assignment, so it cannot be used to react to the final Source Document value.

Describe the request

Add an integration event OnCreateWhseDocPlaceLineOnAfterAssignSourceDocument in CreateWhseDocPlaceLine in Codeunit 7312 "Create Pick" after the conditional Source Document assignment on WarehouseActivityLine and before TempWarehouseActivityLine.Delete().

if not (WarehouseActivityLine."Whse. Document Type" in [
                                        WarehouseActivityLine."Whse. Document Type"::"Internal Pick",
                                        WarehouseActivityLine."Whse. Document Type"::"Movement Worksheet"])
then
    WarehouseActivityLine."Source Document" := WhseManagement.GetWhseActivSourceDocument(WarehouseActivityLine."Source Type", WarehouseActivityLine."Source Subtype");

OnCreateWhseDocPlaceLineOnAfterAssignSourceDocument(WarehouseActivityLine); // <---- New Event
TempWarehouseActivityLine.Delete();

Event Signature:

[IntegrationEvent(false, false)]
local procedure OnCreateWhseDocPlaceLineOnAfterAssignSourceDocument(var WarehouseActivityLine: Record "Warehouse Activity Line")
begin
end;

Alternatives evaluated: OnCreateWhseDocPlaceLineOnAfterTransferTempWhseActivLineToWhseActivLine fires before the source document is assigned, so a subscriber cannot react to or override the final Source Document value. OnCreateWhseDocPlaceLineOnAfterSetFilters fires before the loop begins and does not expose WarehouseActivityLine at all. No event currently exists between the source document assignment and the TempWarehouseActivityLine.Delete() call in this loop.
Internal work item: AB#636044

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions