- Two types of Events exist
- NAV CAL Events
- Eg. OnValidate
- SQL Trigger Events
- Eg. OnAfterModifyEvent
- Publisher
- A custom function with a single parameter
- C50000 = Publisher
- Global Function = AfterValidate
- Parameter = Name
- Properties as follows
- Event: Publisher
- Eventtype: Integration
- If we wanted to Publish P21 Customer.Name OnValidate()
- In Customer Object, Name OnValidate() CAL
- Create global = Publisher,Codeunit 50000,Publisher
- Add line Publisher.AfterValidate(Name)
- Now, whenever Customer.Name OnValidate() occurs, Publisher.AfterValidate will "Publish"
- Subscriber
- A custom function C50001:Custom,function CusNameChanged containing custom CAL with Properties as follows
- Event = Subscriber
- EventPublisherObject = P21 Customer Card
- Eventfunction = AfterValidate
- Do not change the default Parameters that get created after selecting the eventfunction or your trigger will not work
- Enter any custom CAL on this function
- Now, the Event is linked to the publisher, which is linked to the subscriber
- Whenever the Event happens, the Publisher triggers, and the Subscriber executes
- Event: Customer.Name OnValidate() executes
- Publisher: Publisher.AfterValidate(Name) executes and sends trigger
- Subscriber: Custom.CusNameChanged() executes
Monday, February 25, 2019
Dynamics NAV - Events, Publishers and Subscribers
https://docs.microsoft.com/en-us/dynamics-nav/walkthrough--publishing--raising--and-subcribing-to-an-event-in-microsoft-dynamics-nav
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment