Hi all
I have stumbled on a potential bug, or at least a annoying thing regarding Event Subscription.
If I create a OnAfterValidate subscription of a field in a table, and put my code in it. All is good, and code is executed.
If I then change the name of the field I am subscribing to, then the field name in the subscriber function is NOT updated, like normal table field names, used for example in the code of the function. This is updated as normal.
Fair enough, BUT the biggest problem is, that my codeunit compiles without error, even though the field name in the function properties doesn't exist.
Bug or just Bad ? Discovered it before going to production this time, but by accident!
NAV 2017 CU10
Follow me on my blog
juhl.blog0
Answers
If you think about it, how this is implemented: the publisher-subscriber binding is generated in memory, when NST loads the metadata, not when objects are compiled. Therefore compiler simply does not really need to know if publisher exists at compilation time.
DEV Env helps creating subscribers by looking at publisher signature and creating the same parameters in subscriber definition, but it does not place hard link/reference in the compiled code. Therefore if you change publisher name the subscriber is still valid - when the NST load the metadata there will be no publishers for it - that's all.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
But still I miss some kind of validation process or a way to check for subscribers with no publisher. Just like when we compile all object to see if all adds up.
One could write a check procedure, if I had the time :-)
Thanks får your input.
I will have to check tomorrow!
Yes that's annoying, but not a bug (at least for me).
The link is broken even if you rename a parameter (for example Rec ==> SalesHeader).
You can check broken subscribers in the event subscriptions page.
Errors are as expected in Event Subsriptions page