Event Suggestion in Microsoft Dynamics NAV 2016

Event Suggestion in Microsoft Dynamics NAV 2016

Editor’s Note: Saurav Dhyani is proposing an enhancement to Microsoft Dynamics NAV 2016. If you think this feature should be part of the base application, please vote for it on Microsoft Connect. If you have a suggestion of your own, feel free to propose it.

Scenario: A new custom field is added to the Sales Line Table and Purchase Line Table. The Value of Field is required in Item Ledger Entries.

Microsoft Dynamics NAV Process

The Field will be transferred to Item Journal Line before it gets posted to Ledgers. The Field Value is transferred in Journals using Code units 80 and 90.

Issue in Microsoft Dynamics NAV 2016

  • With Events & Subscriptions in Microsoft Dynamics NAV 2016, the base application code should not be customized or modified.
  • For transferring values from Sales and Purchase Lines to Journal Lines, NAV 2016 does not have events which can be subscribed.

Suggested Solution

In Codeunits 80 and 90, add a new function, called RunItemJnlPostLine, as shown below:

Codeunit 80 – Sales Post

New function in Codeunit Sales-Post.

Figure 1. New function in Codeunit Sales-Post.

Codeunit 90 – Purchase Post

New function in Codeunit Purch.-Post.

Figure 2. New function in Codeunit Purch.-Post.

The Function call should be in the Function PostItemJnlLIne of both the Codeunits, as shown below:

Codeunit 80 – Sales Post

Code changes in function PostItemJnlLine.

Figure 3. Code changes in function PostItemJnlLine.

Two Events are required in new function, RunItemJnlPostLine, as shown below:

New Events in Codeunit Sales-Post.

Figure 4. New Events in Codeunit Sales-Post.

Codeunit 90 – Purchase Post

Code changes in function PostItemJnlLine.

Figure 5. Code changes in function PostItemJnlLine.

Two Events are required in the new Function, RunItemJnlPostLine, as show below:

New Events in Codeunit Purch.-Post.

Figure 6. New Events in Codeunit Purch.-Post.

These Events will allow you to transfer values from Sales & Purchase Lines to Item Journal Lines.

If you have any questions about this function or other Dynamics NAV questions for any version, contact ArcherPoint.

Read our “How To” blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV.

If you are interested in NAV development, check out our collection of NAV Development Blogs.

Read more Dynamics NAV blogs by Saurav Dhyani.

Trending Posts

Stay Informed

Choose Your Preferences
First Name
*required
Last Name
*required
Email
*required
Subscription Options
Your Privacy is Guaranteed