Business Events

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)

event1

“Subscribe” Event

> Codeunit 80000 Functions ErrorItemRenaming(“No.”)

  • EventPublishedObject “Codeunit My Publishers”
pub2

 

“Publisher & Subscriber”

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

 

“Raise Event”

On Table 27 Item –> No. OnValidate()

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

 

MAPPING EVENTS

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

map6

“Event Function”

  • Example OnItemCodeRenamed(parItemNo:Code20) mapped on EventFunction
pub7

 

Publisher

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

 

“EVENTS SUBSCRIPTIONS LIST”

  • 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
pub9

 

RUNNING (RAISING)

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

pub10

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

-Integration Events in Microsoft Dynamics NAV 2016

https://blogs.msdn.microsoft.com/nav/2015/10/15/integration-events-in-microsoft-dynamics-nav-2016/

Introducing Events  ->  https://msdn.microsoft.com/en-us/library/mt299398(v=nav.90).aspx

Get Starting With Eventing ->  https://msdn.microsoft.com/dynamics/nav/mt598589

Annunci

1 risposta »

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...