Background Posting and Job Queue in Microsoft Dynamics NAV 2013

Do you or your customers have peak hours when all the sales orders and invoices need to be posted at the same time? Or do you have large batches of postings that need to be run without blocking other users? I bet the answer is yes. If so, then you may also have experienced your screen “freezing up” for several seconds –minutes even -- until the order is processed. “Try again later” is also a well-known option.

To provide a better user experience and control of the posting, we have added the ability to post sales and purchase documents in the background. The user experience resembles that of printing of a document; the document to be printed is sent to the printer server and when the printer is ready, the document is processed. Typically, there is very little wait time – and the same goes for background posting.

It is important to note that when the posting is happening in the background, it uses a dedicated user session to ensure that the posted document is posted as being posted by the user. So it is still possible to track who did the posting.

The status of the posting can be identified in a few ways:

  1. Errors with the posting will always notify the user who initiated the posting. This is done through notifications. It is also possible to turn on notifications for successful jobs.
  2. For orders and invoices, we have introduced a job queue status column on the list pages. The same information can be found on the individual order and invoice pages.
  3. A new job queue part can be added to the role centers and it enables an overview of the job queue entries in progress.

Background posting uses the job queue, which has been enhanced in many ways in this version. In Microsoft Dynamics NAV 2013 the job queue can run either directly in the user session or it can be run through a dedicated NAS Service. Additional flexibility in the way the job queue can be set up has also been the focus of the release. Now, the job queue has the following capabilities:

  • It is possible to run many job queues with selection criteria per company.
  • You can have more than one job queue running on the same server at the same time.
  • The user’s jobs will run with the user’s permissions, so no special security setup is required.

We hope that these enhancements to the job queue combined with the background posting will open up more flexible usage of Microsoft Dynamics NAV and will lead to more efficient users and a better experience in peak hours.

Set up and Use Background Posting with Job Queue

In order to set up background posting, there are several areas that are worth highlighting:

  1. Background posting covers both the sales and the purchase side and has been implemented for the  following areas: Sales Order, Sales Invoice, Sales Credit Memos, Sales Return Order, Purchase Order, Purchase Invoices, Purchase Credit Memos and Purchase Return Order.
  2. The sales and the purchase sides are set up separately.
  3. Background posting covers the Post as well as the Post and Print scenarios. But remember to set up printers and NAS Service on the server correctly if Post and Print is activated.
  4. We recommend that you set up the job queue to run on a dedicated NAS Service, but for demoing purposes, it is easier to start the job queue on the existing session. This blog post will focus on the job queue run and not the NAS Service setup; see the product Help for considerations around the NAS service setup.

Set Up Background Posting

The first step is to set up the background posting, in this case, the sales side.

On the Sales & Receivables Setup page, a new FastTab has been added: Background Posting.

You activate background posting for sales documents by selecting the Post with Job Queue check box. To ensure that you have a dedicated job queue, you can provide a Job Queue Category Code. This routes the posting to the correct job queue.

The same applies for Post & Print – it is also set up if you select the check box.

The posting will create a job queue entry with the priority 1000. The priority field is used to determine the order of processing the job queue entries. By setting this to 1000, it is easier to allow other jobs to get in front of the queue.

Activate the Notify On Success check box if you want the user that posted the document to notified about the state of posting. There will be a notification attached to the posted document as well as a notification in the My Notifications part on the role center.

You can apply the same steps to the Purchases & Payables Setup page.

Set Up Job Queue

The next step is to set up a job queue to run the background posting.

In the job queue card, you create a new dedicated job queue. The Job Queue Category Filter resembles the filter set on the background posting setup. So this job queue will only run the job queue entries with the category Sales Post. The remaining fields in the General FastTab show the status of the job queue. In this case, the job has been started from the same session by the Start Job Queue action.

In the NAS Settings FastTab, it is possible to choose which NAS service the job queue must run on.

Note: The NAS Service needs to be restarted to pick up a new job queue.

Now, the application has been configured and it is possible to start posting.

Running Background Posting

Posting a sales order will create a job queue entry to be run on the dedicated job queue. This will execute the posting routine and if required, it will be sent to a printer. There is a visible difference in the posting routine, since the background posting will notify the user that the order has been sent for posting instead of showing the actual posting steps.

In the sales order list, it is possible to see the state of the posting. Showing the job queue status column on the list page will show the state of the posting.

If notification is turned on in the set up, it is very useful to add the Notes FactBox to the list page as well. This is really valuable in cases where the posting for some reason doesn’t finish.

In the case below, there is nothing to post which can be seen by the job queue status and the notification. Opening up the note shows the error message “There is nothing to post.”

It is also possible to see that there is something wrong in the posting on the role center. The My Notifications part shows any errors related to the posting. The same error can be found in the My Job Queue part.

The My Job Queue part also shows the progress of the jobs. Any job queue errors will be readable from the entry in the job queue. Failing job queue entries are displayed in red, while the job queue entries in line are displayed in black.

-Rikke Lassen

Comments (3)

  1. Sandro K. says:

    What is the correct Configuration for a NAS for background posting?

    Do we need a seperate NAS for each company?

  2. Rikke Lassen says:

    I will add the steps for a simple configuration of the NAS, but please refer to the online help for NAS and admin console as well.

    As for the question: One NAS can service multiple companies, but it does need a company to start up.

    Configuring NAS to use Job Queue

    1. On the Server machine, start the Dynamics NAV Administration Console

    2. Select the server instance and click the Edit button

    3. Go to the NAS Services fast-tab

    4. Set the Company field value to CRONUS International Ltd.

    5. Set the Startup Codeunit field value to 450

    Alternatively you can change the setup of step 5 to:

    Set the Startup Codeunit field value to 1

    Set the Startup Method field value to NASHandler

    Set the Startup Argument field value to JOBQUEUE

    Click Save

    * NOTE: The advantage of this alternate method is simply to allow entering sequences of arguments where each will be executed sequentially once NAS starts. This is good for (eg.) cleaning up some table before the Job Queue starts. a NAV developer is needed to update COD44.NASHandler however.

    Remember to Configuring the Job Queue to use the NAS

    Go to Job Queues list page

    In the NAS Settings fast-tab, set Start Automatically From NAS field value to TRUE

    Click the OK button to close the card

    Starting NAS

    Select the server instance in the Dynamics NAV Administration Console

    Click Restart from the Action pane

    Wait a few seconds to observe the Status field change to Running

    I hope this helps


  3. Igor Ch. says:

    I actually thought that the reason for the recommendation of running job queue as separate service instance in case of background posting is the performance and isolation of the task. However I have found out that the background posting actually always runs on the service instance where the user initially run the Post or Post & Print and not on the NAS service instance, and the only thing that the Job Queue in the awkward way does is that it pushes and monitors the status of the background posting task. If such a service instance for the users is for whatever reason restarted then the background posting tasks fails unless and the original user has to login again (NAV2015) or even push the restart button on the task …

    Just a suggestion to MS: Why is it not possible to "impersonate" the user when running STARTSESSION? If that was possible then the background posting could be really run as any other job queue entry on the job queue service instance, without all the hassle around, and any service restarts would have almost no impact on it. If that is because of the "security" and risk of stealing the identity then I would just note that STARTSESSION calls are in the hands of the developers anyway and they can usually tamper the data as needed …

Skip to main content