Skip to content

[W1][Report][7305][Whse.-Source - Create Document] Add Integration Event OnAfterGetHeaderLocationCode in GetHeaderLocationCode procedure #30145

@mavohra

Description

@mavohra

Why do you need this change?

GetHeaderLocationCode uses a case statement to return the location code from the appropriate source record for each WhseDoc value. The base case has an else branch that returns SourceLocationCode as a fallback for any unrecognised WhseDoc value. Custom document types such as "Staged Pick" have their own source record (WhseStagedPickLine) whose "Location Code" must be returned instead. Because the else branch silently returns SourceLocationCode, the wrong location code is used downstream without any error, making this failure mode difficult to detect.

There is no event before/after the case statement that allows subscribers to apply custom code or exit the procedure early for custom WhseDoc values.

Describe the request

Add OnAfterGetHeaderLocationCode at the very end of case block so subscribers can also populate custom case.

 local procedure GetHeaderLocationCode(): Code[10]
 begin
        case WhseDoc of
            WhseDoc::"Put-away Worksheet",
            WhseDoc::"Whse. Mov.-Worksheet":
                exit(WhseWkshLine."Location Code");
            else
                exit(SourceLocationCode);
        end;
       OnAfterGetHeaderLocationCode(WhseDoc, LocationCode)  // ← event added here
  end;

Event Signature:

[IntegrationEvent(false, false)]
local procedure OnAfterGetHeaderLocationCode(
    WhseDoc: Option;
    var LocationCode: Code[10];)
begin
end;

Alternatives evaluated:
This can also be achieved by raising an integration event with IsHandled before the case block — when a subscriber sets
IsHandled := true, the procedure exits immediately, allowing custom code to execute. No event currently exists in GetHeaderLocationCode that exposes WhseDoc and allows subscriber to override the return value before the case executes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-infoThe issue misses information that prevents it from completion.

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions