Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum
Suggested answer

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!

  • 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,861 Moderator 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

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,537 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,520 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans