Publish, Raise and Subscribe

Publish, Raise and Subscribe

Something about NAV Events (Integration & Business Events)….  Some Definitions of: “Publishers & Subscribers”

“A publisher” exposes hook-points in code or processes that other partners or sub-systems can leverage. ISVs and Microsoft are the typical providers of published events, but not necessarily the only providers. Events are raised through explicit function calls, or raised implicitly by the Microsoft Dynamics NAV Runtime.

“A subscriber” subscribes to and handles events. When an event is raised, the subscription code is automatically called by the runtime. This enables partners to hook into core Microsoft Dynamics NAV functionality without having to do ‘classic’ code modification. Any Microsoft Dynamics NAV solution provider, including Microsoft, can use event subscriptions.

Example new codeunit “80000 My Publisher”

“Publisher” Event

> Codeunit 80000 Function [Integration Event] OnItemCodeRenamed(parItem:Code20)


“Subscribe” Event

> Codeunit 80000 Functions ErrorItemRenaming(“No.”)

  • EventPublishedObject “Codeunit My Publishers”


“Publisher & Subscriber”

  • Void Containers only “to map Events” in events list
  • Publisher Integration Event > ex. OnItemCodeRenamed(“No.”)
  • Subscriber EventSubscriber > ex. ErrorItemRemaining(“No.”)


“Raise Event”

On Table 27 Item –> No. OnValidate()

  • cdyMyPublisher.OnItemCodeRenamed(“No.”); // Raise Event > Call codeunit function on No. Onvalidate Trigger



 -> “NEW EVENT IS NOW PUBLISHED AND AVAILABLE”; Now “new EVENT” is mapped and available to use on EVENT FUNCTIONS LIST


“Event Function”

  • Example OnItemCodeRenamed(parItemNo:Code20) mapped on EventFunction



  • OnEvaluateField(“No.”) > raising EventFunction “OnBeforeValidateEvent(“No.”)



  • My Custom Codeunit (raiser) with exposed function is available on subscriptions event list
  • In this case is: “Business Event” published from table 27 by OnBeforeValidateEvent Function



  • Example of raising ERROR(“No.”) function when ErrorItemRemaing() function is running


… you can find a lot of information about NAV Events on NAV team blog and MSDN Online

-Integration Events in Microsoft Dynamics NAV 2016

Introducing Events  ->

Get Starting With Eventing ->

Publish, Raise and Subscribe

One thought on “Publish, Raise and Subscribe

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top
%d bloggers like this: