HideDialog When background process create pick list

samantha73samantha73 Member Posts: 77
Hi All
I'm struggling to hide the dialog box (nothing to handle ) when creating warehouse picks from code unit. The aim is to create a process that can be run using job queue that process warehouse shipments and create warehouse picks. When there is inventory or no prior pick list for the Whse Shipment the code works but other wise "nothing to handle error" comes up. I'm using report "Whse.-Shipment - Create Pick" but no idea how to suppress pop up errors:
here's the code so far for the codeunit:
trigger OnRun()
    var
        WhseShptHeader: Record "Warehouse Shipment Header";
        WhseShptLine: Record "Warehouse Shipment Line";

        WhseShipmentCreatePick: Report "Whse.-Shipment - Create Pick";
        IsHandled: Boolean;
        HideValidationDialog: Boolean;
       // NewHideValidationDialog: Boolean;
        HideNothingToHandleErr: Boolean;
       // HideNothingToHandleError: Boolean;
    begin
        HideValidationDialog := true;
        HideNothingToHandleErr := true;
       // NewHideValidationDialog := true;

       // HideNothingToHandleError := true;

        WhseShptHeader.SetFilter("No.", '=%1', 'WS0000281');
        WhseShptHeader.setrange(Status, WhseShptHeader.Status::Released);
        if WhseShptHeader.FindFirst() then
            WhseShptLine.SetRange("No.", WhseShptHeader."No.");
        WhseShptLine.SetFilter(Quantity, '>0');
        WhseShptLine.SetRange("Completely Picked", false);
        if NOT WhseShptLine.FindSet() then
            exit else begin

            WhseShipmentCreatePick.SetWhseShipmentLine(WhseShptLine, WhseShptHeader);
            WhseShipmentCreatePick.SetHideValidationDialog(HideValidationDialog);
            WhseShipmentCreatePick.UseRequestPage(not HideValidationDialog);
            WhseShipmentCreatePick.RunModal;
            WhseShipmentCreatePick.SetHideNothingToHandleError(HideNothingToHandleErr);
            //WhseShipmentCreatePick.GetResultMessage;
            Clear(WhseShipmentCreatePick);

        end;

    end;

Not sure how to use integration events or access them when running the code unit above. Below is one event
[IntegrationEvent(false, false)]
    local procedure OnBeforeSortWhseActivHeaders(var WhseActivHeader: Record "Warehouse Activity Header"; FirstActivityNo: Code[20]; LastActivityNo: Code[20]; var HideNothingToHandleError: Boolean)
    begin
    end;

. Perhaps there is a different way to solve this?
Thanks
Sign In or Register to comment.