ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] - table 83 "Item Journal Line" - LookupProdOrderComp - OnLookupProdOrderCompBeforeSetTableView

Open bcarmo-dev opened this issue 2 years ago • 1 comments

Describe the request

I would like the ability to apply additional filters to the "Prod. Order Component" record before the page opens. I am aware that the IsHandled pattern is utilized in the OnLookupProdOrderCompBeforeRunModal integration event, but since the Rec is not passed as a parameter, overwriting the standard behavior does not grant control over the actual record. Moreover, our goal is not to overwrite the standard behavior but merely to set extra filters on the "Prod. Order Component" record.

This way, I'm requesting a new event "OnLookupProdOrderCompBeforeSetTableView".

Additional context

    local procedure LookupProdOrderComp()
    var
        ProdOrderComp: Record "Prod. Order Component";
        ProdOrderCompLineList: Page "Prod. Order Comp. Line List";
        IsHandled: Boolean;
    begin
        ProdOrderComp.SetFilterByReleasedOrderNo("Order No.");
        if "Order Line No." <> 0 then
            ProdOrderComp.SetRange("Prod. Order Line No.", "Order Line No.");
        ProdOrderComp.Status := ProdOrderComp.Status::Released;
        ProdOrderComp."Prod. Order No." := "Order No.";
        ProdOrderComp."Prod. Order Line No." := "Order Line No.";
        ProdOrderComp."Line No." := "Prod. Order Comp. Line No.";
        ProdOrderComp."Item No." := "Item No.";

        ProdOrderCompLineList.LookupMode(true);
        // New Event Begin
        OnLookupProdOrderCompBeforeSetTableView(ProdOrderComp, Rec);
        // New Event End
        ProdOrderCompLineList.SetTableView(ProdOrderComp);
        ProdOrderCompLineList.SetRecord(ProdOrderComp);

        IsHandled := false;
        OnLookupProdOrderCompBeforeRunModal(ProdOrderComp, IsHandled);
        if IsHandled then
            exit;

        if ProdOrderCompLineList.RunModal() = ACTION::LookupOK then begin
            ProdOrderCompLineList.GetRecord(ProdOrderComp);
            if "Prod. Order Comp. Line No." <> ProdOrderComp."Line No." then begin
                Validate("Item No.", ProdOrderComp."Item No.");
                Validate("Prod. Order Comp. Line No.", ProdOrderComp."Line No.");
            end;
        end;
    end;
    [IntegrationEvent(false, false)]
    local procedure OnLookupProdOrderCompBeforeSetTableView(var ProdOrderComp: Record "Prod. Order Component"; ItemJournalLine: Record "Item Journal Line" )
    begin
    end;

Internal work item: AB#545024

bcarmo-dev avatar Aug 19 '24 10:08 bcarmo-dev

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: 23206.

JesperSchulz avatar Aug 22 '24 20:08 JesperSchulz