web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

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

(0) ShareShare
ReportReport
Posted on by 358

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!

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at

    Hello,

    This is out of the box avaiable:

    cloudblogs.microsoft.com/.../

    Thanks.

  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,284 Super User 2025 Season 2 on at

    Your question has already been answered in the D365BC Forum.

    But, I will just post the answer here again for people who is looking at this NAV forum.

    thatnavguy.wordpress.com/.../

  • Bodhi Profile Picture
    558 on at

    write a function in a codeunit or write a new one:

    Use Job queue to call this function

    First we need to define the variables.

    SalesHeader: Record "Sales Header";

    SalesPost: Codeunit "Sales-Post";

    Once you declare the variable, you can start writing the logic. The following code will post both the shipment and invoice.

    case SalesHeader."Document Type" of

     SalesHeader."Document Type"::Order:

         SalesHeader.Ship := true; //false if you do not want to post shipment

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

         SalesHeader.Receive := true; //false if you do not want to post return receipt

    end;

    SalesHeader.Invoice := true; //false if you do not want to post the invoice

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans