Hi,
We have decided to use events in new customizations which will reduce modifying standard objects.
But our experience has demonstrated that the use of these special events brings big problems
Indeed, events are executed randomly.
Using the debugger, we have demonstrated that NAV does not always running the events (this example is an event onafterinsert on table Sales lines).
However if we recompile the object, the event is well run .... until the next time it will not be more.
HAs someone encountered the same problem?
THanks for your repply.
0
Answers
No, I didn't face this problem before.
can you provide more details please.
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
an example : this fonction
[b]LOCAL [EventSubscriber] Table_36_OnAfterInsert(VAR Rec : Record "Sales Header";RunTrigger : Boolean)
IF NOT RunTrigger THEN
EXIT;
[/b]
"Created user ID" := USERID;
The result is sometimes the field Created user ID is empty and sometimes the field is good.
So we have put a breakpoint in this instruction , and debugging has showed that sometimes NAV goes in the event, and sometime don't go into. And when NAV don't execute event, we recompile codeunit with the event and so NAV execute correctly the event, some hours ....
can you simply try with
"Created user ID" := USERID;
can you sync the db once or restart the service after changes.
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
For example create recupel TAxe line. And same problem, new lines are created randomly. When the user has the problem, just recompile objet and the user hasn't more the problem. but some days or hours later the user has the problem again
No need sync database, or restart service, just recompile the codeunit that contains the event.
Ishwar Sharma
My Blogs: Dynamics Community Blog | Blogspot
Connect: Google + | Twitter
I have tested with CU12, and same problem
I have tested with modify, same problem.
I have debugging and nav don't pass in the event !
So any code present in the event, is executed.
Is "IF NOT RunTrigger THEN EXIT; " condition present in your event function? I think it might be causing the issue.
I resolved my problem by checking the conditions and debugging the code, I found some code which was preventing the system to enter into the event function.
Please try compiling all objects with validation.
Ishwar Sharma
My Blogs: Dynamics Community Blog | Blogspot
Connect: Google + | Twitter
I have same problem with the code if not runtrigger.... and without the code if not ..... because i have put a breakpoint before the if not runtrigger and debugger don't stop
I don't understand your answer :
"
I resolved my problem by checking the conditions and debugging the code, I found some code which was preventing the system to enter into the event function.
"
Which code have you found that prevent the system to enter into the event function?
Thanks a lot
Another thing : why nav execute event every time i recompile object.
So NAV execute event randomly, and when nav don't execute event, just recompile codeunit with event and nav execute again event.
I have created lot of code with events and extensions but never faced such issue.
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Ishwar Sharma
My Blogs: Dynamics Community Blog | Blogspot
Connect: Google + | Twitter
@marvax Have you tried restarting the NST service - does this help? BTW, If this is a reproducible issue then you should really report to Microsoft - they may be able to help identify the issue or fix it in a later release if it is a bug in the client.
http://www.linkedin.com/in/larswestman
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Well there is such a thing. If the event subscribers are triggered asynchronous, depending on the state of the CPU, certain threads can get priority over others, so yes it is possible that the order in which events are triggered can appear random.