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

Posting Invoice from Sale order lines directly

(0) ShareShare
ReportReport
Posted on by 100

Hi,

Can anyone help me  with small bit of C/AL code to Call Sales Posting CU directly from Sale Order line after filling Qty to ship/Qty to Invoice.

I would like to create invoice directly.

I want run this set of code in a batch program.

Please help

Warm Regards

Kris

I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Do you want to post the sales order as soon as you enter the qty. to ship or invoice? do you want to post only that particular line? what is the issue of using sales post action?

  • KrisMuthy Profile Picture
    100 on at

    100% , I have only one line in sale order.  Just I am filling quantity (qty to ship) using batch job.   immediately  need to post and make qty-to ship to zero and again fill quantity and post.

    directly posting sales invoice without any dialog.

    Warm regards

    Kris

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Add the code in the OnValidate of Qty. to Ship field on the sales line the following code

    If "Qty. to Ship" <> 0 THEN BEGIN

      GetSalesHeader;

      SalesPost.RUN(SalesHeader);

    END;

    Where SalesPost is the of type Codeunit 80.

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