Hello, everyone.
I encountered a weired problem, I have a NAS run in NAV 2009 R2, which import I/F data and create Item journal/General Journal and Post automatically, problem is I will update the Allow Posting From/To for the NAS runner every month. But everytime there will be "The posting date in not within you allowed posting...." kind of error, If I restart the NAS, there will be no error. Seems like if I do not restart NAS, it will not read the updated data from User Setup table, but when I tried in Local it went quite well. Does anyone faced the same problem before?
0
Comments
Assuming you want to execute a recurring task in NAS, of course, the starting codeunit needs to be single instance because the instance of the Timer component must remain in memory (or the Event trigger of an external component needs to be available or something like that). But all the other Objects that are used during one execution of the NAS task could be normal Objects. That way you make sure that it's dropped from memory after it was used and will be created newly in the next execution. No old data will stay in memory. This is somewhat comparable to the garbage collector of other programming languages.
To:geordie
I let user click a button 'Update Posting From and To' to update the Posting From/To, for example, at the end of July, when user click 'Update Posting From and To', system will update the Posting From/To to 2014/08/01-2014/08/31.
To:einsTeIn.NET
Do you suggest to set the Job queue called Codeunit to SingleInstance? Actually the Codeunit is only for NAS.
Now I have two solution, one is set my NAS runner's [Posting To] to "9999/12/31", but my customer may feel not good about it. Two is write log to show which Posting From/To has been got when codeunit run, but if I proved that the date I got is before updated, then what should I do? Restart NAS service every night?
Microsoft also suggest us to use "GETLASTVERSION", but I did not do it. until now, two years passed by, there are two or three times same issue happened, our client choose to manually dealing with it.