What are events exactly for? DIfference between normal Function call and Events

marcussulicmarcussulic Member Posts: 15
Hello community,

I just learnt about NAV Possibilities around Events (Subscriber/Publisher etc) and watched some videos for example https://www.youtube.com/watch?v=Cjt8aQC2aC8&t=3s.
While it surely sounds fun, I struggle to understand what they are exactly for? I must be missing something basic because for me theres no difference between Events which will run some code placed in some external Codeunit and normal function calls which will do the same for me.

Oh yeah the only difference would be that its way harder to debug because you cant "go to definition".

I gladly accept every form of help.
Thanks in advance!

Best regards.

Answers

  • nick_robbonick_robbo Member Posts: 49
    Hi, the purpose is so you can hook into system events. So you do not have to modify Standard NAV code at all to include your own custom code. This makes it easier to upgrade & manage.
  • marcussulicmarcussulic Member Posts: 15
    But you still have to put the event handler in your code and therefore change the code, dont you? Its only 1 line of code but cant you accomplish the same with just a function call to some external codeunit, cant you?
  • zeonzeon Member Posts: 130
    Yes, you can accomplish the same with a function call to an external codeunit, but in case you can use the published events by MS, you do not have to modify the existing standard code base. This obviously makes upgrades a lot easier.
  • NavNabNavNab Member Posts: 181
    Hi marcussulic,

    If you don't care about not modify standard objects in order to save time (money) for upgrades (Cumulative Updates also) then the events are useless :)

    But, you will soon use them (aside Extensions) when MS cuts NAV OnPremise ;)
Sign In or Register to comment.