Greetings Earthlings!
I have a very strange system behaviour after implementing a new function. Maybe someone knows about problems with RecordRef.
I created a new functionality very similar to the Change Log functionality. The only difference is that my function isn't called by CU 1 but by the Modify Trigger of some tables or by the Validate Trigger of certain fields of these tables. And of course I don't use the Change Log Tables to setup my function and to store the created entries.
If my function is called by the Modify Trigger then the client crashes always after the function IsNormalField has been called. The Debugger steps back into the function LogModification and the windows message for reporting the error pops up. Nothing else. No "internal error x in module y" or something like that.
If my function is called by the Validate Trigger of a field then it works really good.
Does anyone has a suggestion what I can do?
Comments
http://www.BiloBeauty.com
http://www.autismspeaks.org
So basically your having problems using your code in OnModify but it works fine in OnValidate.
http://www.BiloBeauty.com
http://www.autismspeaks.org
But I don't think it has anything to do with this difference. I think it's the way Navision handles RecordRefs. Maybe I should post the code of both functions. Normally everybody who worked for a longer time with the Navision development environment should have heard of these functions but maybe only a few keep them in mind.
IsNormalField(TableNumber : Integer;FieldNumber : Integer) : Boolean
LogModification(VAR RecRef : RecordRef;VAR xRecRef : RecordRef)
The debugger goes through the function IsNormalField and jumps back into the function LogModification and then the client crashes. I put in a message in like this but even this message will not be executed.
I even made a client update (technical). Now 4.00 SP3 but it didn't solve the problem.
Solution: Extend the field length to a minimum of 10 characters.
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
I have read here in one topic that there are some problems with RecordRef if you have not closed the RecordRef correct. And in another topic that there will be a check for an incorrect close of RecordRef in NAV 5.0. Sorry, but I can't find both topics again yet. Maybe it has something to do with that problem?
[edit]
this is the first topic ... (still searching for)
and this is the 2nd topic http://www.mibuso.com/forum/viewtopic.php?t=19865
I tried to put in a RecRef.CLOSE after every call, but that didn't solve the problem anyway. Maybe I should use CLEAR instaed of CLOSE or maybe RESET as suggested in this thread http://www.mibuso.com/forum/viewtopic.php?t=17087???
[/edit]
I think the problem is comparable to this problem http://www.mibuso.com/forum/viewtopic.php?t=14150. A function that works really great is called in another context and the Navision Client will crash. Very strange!