Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Trying to find a codeunit to help me automate posting shipment.

Posted on by 350

I am trying to write a Job Queue codeunit that will at an interval try to post sales shipment from Sales Order. I have looked into

Sales-Post (Yes/No) and Sales-Post codeunits and could not find a procedure that I can use to Post a Sales Shipment from a Sales Order document.
What codeunit is available that will assist me in passing a sales header and possibly sales line and will post a sales shipment for me? Thanks a ton for the advice!
  • mysamza Profile Picture
    mysamza 350 on at
    RE: Trying to find a codeunit to help me automate posting shipment.

    This worked. Thanks.

  • Suggested answer
    Avinash B Profile Picture
    Avinash B 1,455 on at
    RE: Trying to find a codeunit to help me automate posting shipment.

    Hi

    I would suggest creating a new codenit, filter sales orders, and make Ship boolean as true in the sales header. Then call the Codeunit 80 (Sales-Post)

    You can use the newly created codeunit to run your job queue.

    Regards

    Avinash B

  • Verified answer
    TeddyH Profile Picture
    TeddyH 12,868 Super User 2024 Season 1 on at
    RE: Trying to find a codeunit to help me automate posting shipment.

    Try this.

    SalesHeader: Record "Sales Header";

    SalesPost: Codeunit "Sales-Post";

    case SalesHeader."Document Type" of

      SalesHeader."Document Type"::Order:

          SalesHeader.Ship := true;

      SalesHeader."Document Type"::"Return Order":

          SalesHeader.Receive := true;

    end;

    SalesHeader.Invoice := false;

    Clear(SalesPost);

    SalesPost.Run(SalesHeader);

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