Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Can I run the OOB code unit for Create Pick from Warehouse Shipment document?

Posted on by 25

Hi team, 

We are trying to create automatically the Pick from a Warehouse Shipment document when all items are available to be picked (to avoid "nothing to handle" error message in Warehouse people's operation). The only missing part is to run the native Create Pick Action that is available in Warehouse Shipment document, we are not sure how to add the Warehouse Shipment input to run the code unit. 

pastedimage1679086541262v1.png

Do you have any ideas on how to proceed? I appreciate the help. 

Thank you, 

  • Suggested answer
    Bilal Haider Profile Picture
    Bilal Haider 45 on at
    RE: Can I run the OOB code unit for Create Pick from Warehouse Shipment document?

    Hi,

    This is the procedure in standard that is creating Pick from Warehouse document. You can get inspiration from this. But make sure you have done proper validations to avoid inconsistencies.

        procedure CreatePickDoc(var WhseShptLine: Record "Warehouse Shipment Line"; WhseShptHeader2: Record "Warehouse Shipment Header")
        var
            IsHandled: Boolean;
        begin
            IsHandled := false;
            OnCreatePickDocOnBeforeCreatePickDoc(Rec, WhseShptLine, WhseShptHeader2, HideValidationDialog, IsHandled);
            if IsHandled then
                exit;
    
            WhseShptHeader2.TestField(Status, WhseShptHeader.Status::Released);
            WhseShptLine.SetFilter(Quantity, '>0');
            WhseShptLine.SetRange("Completely Picked", false);
            if WhseShptLine.Find('-') then
                CreatePickDocFromWhseShpt(WhseShptLine, WhseShptHeader2, HideValidationDialog)
            else
                if not HideValidationDialog then
                    Message(Text011);
        end;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans