Eventos en Dynamics NAV 2016

hat do we do .. Keep using hooks? Or use events instead?

Well, one thing for sure: Microsoft Dynamics NAV Events can’t fully replace hooks, just because of the fact that there aren’t enough of them .. or they are not raised on the places we need it to be raised. To give you an easy example: On Sales Line, OnValidate of the field “No.”, there is a lot of checking going on (lots of TESTFIELDS) in the beginning of the trigger. Well, it makes also sense to “hook in” as an OnBeforeValidate – but AFTER these checks. Which actually means: the default (in this case) trigger event can’t be used. Therefore, we’re still using hooks, like you see here:

The “OnBefore” is not really OnBefore, but actually “OnJustAfterAllTheChecks…”

In my opinion, we will always have these kinds of hooks – it will be difficult for Microsoft to foresee all possible places partners would want to hook into anyway. Not any code design or any pattern will foresee every possible hook. Then again .. applying some patterns will sure make up for lots of them ;-).

But anyway …

So, what is it then .. Events or Hooks?

Well .. let’s talk product development for a moment in terms of “execution order of events”. When you’re creating a product, you usually are creating processes, workflows, .. stuff that somewhat have a connection with each other .. although you’re as generic as possible 

Share