Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 64797

Publish, Raise and Subscribe

$
0
0

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 raisedthrough 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



Viewing all articles
Browse latest Browse all 64797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>