Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Auto post Sales Invoice

(0) ShareShare
ReportReport
Posted on by

Hi All,

We have created the following:

1. Webservice to create sales invoice (Sales invoice created successfully with status "Open")

2. Job Queue to post Sales Invoice in the background (Sales invoice was scheduled and post successfully)

However to get from Step 1 to Step 2, user has to manually click "Post" in Sales Invoices page (as shown below).

2318.Sales-Invoice-Posting-automation.PNG

How can I automate the above step, so that the Sales Invoice posting can be automated without any human intervention.

Thank you.

Regards,

Susy

*This post is locked for comments

  • RE: Auto post Sales Invoice

    sir 

    I want to send posted sale invoice automatically please help me  

  • CharithSilva Profile Picture
    CharithSilva 330 on at
    RE: Auto post Sales Invoice

    If you havent still found the answer, here is the link you need (I have done this last month and it works beautifully)

    blogs.msdn.microsoft.com/.../extending-page-web-services-and-creating-a-sales-order-again

  • antoniojrsilva Profile Picture
    antoniojrsilva 75 on at
    RE: Auto post Sales Invoice

    Hi

    I have the same problem in 2017, when it runs the 88 codeunit it gives the same error "Record ID to Process...."

    I don't know what I can do more, any idea?

    Thanks

    Antonio

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: Auto post Sales Invoice

    Ok that is the reason why the users need to click post button, the background posting uses codeunit 88 and it is designed to avoid multiple orders processing at the same time, so when users clicks Post it will mark the order and the background process takes care of posting.

    If you don't want any user intervention then create a new codeunit and add the provided code and then use the new codeunit in the job queue.

    Please remember it will try to post all the sales invoices, so if you want only specific sales invoices then you need to specify that in the code.

    How to create a job queue entry.

    msdn.microsoft.com/.../hh879053(v=nav.90).aspx

  • RE: Auto post Sales Invoice

    Hi Suresh,

    I have not changed any code unit.

    The job queue is the standard NAV job queue that is enabled on Sales and Receivables setup.

    BAckground-posting.png

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: Auto post Sales Invoice

    You could add provided code in a codeunit as a function and publish as webservice which will take care of posting or you could add this in your background job, what is the background object you are using in the Job queue for posting and what code do you currently have over there.

  • RE: Auto post Sales Invoice

    Hi Suresh,

    External system is calling NAV webservices - page 43.

    Then I have setup the background job queue to auto post sales invoice.

    Regards,

    Susy

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: Auto post Sales Invoice

    So external system is calling your NAV webservices correct ? if so are you using page web services or codeunit web service ?

  • RE: Auto post Sales Invoice

    Thanks Suresh.

    By any chance can the above code be added to web service so that we can combine Step 1 and Step 2 in one step?

    Regards,

    Susy

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: Auto post Sales Invoice

    Susy,

    You need to add the following code for posting to occur, you could add that in a codeunit or in report (which can be used for processing), once the sales invoice is created just the below code to occur posting.

           SalesHeader.Invoice := TRUE;

           SalesPost.SetPostingDate(TRUE,FALSE,TODAY);

           SalesPost.RUN(SalesHeader);

    Where SalesPost is the codeunit 80

    Look at report 297 which is Batch Post Sales Invoices which you can schedule for posting but please remember you need a way to identify which one you want to post.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans