Skip to main content

Notifications

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 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!

  • Bodhi Profile Picture
    Bodhi 554 on at
    RE: Trying to find a codeunit to help me automate posting shipment.

    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);

  • Suggested 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.

    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/.../

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: Trying to find a codeunit to help me automate posting shipment.

    Hello,

    This is out of the box avaiable:

    cloudblogs.microsoft.com/.../

    Thanks.

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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans