If you mean to log every time there is a designer change to the data length of a code or text field, then yes, it is possible to log. If you are using a more recent version of Nav (I think 2009 is the first that supports these), you can use the new database change "triggers" (I say triggers, but technically they are just procedures the client calls) defined in Codeunit 1. You would put some C/AL code in the GetDatabaseTableTriggerSetup and OnDatabaseModify procedures. Your code would check if the record being modified is in the Object table, and then if so, log the change if the length is different. You most certainly want to do something like this in a dev system first, since messing with Codeunit 1 can lead to some serious problems from even the most minor of errors.
Below is some example code, which I have NOT tested, so you may need to make changes. the MyLoggingCodeunit would be your custom Codeunit, of course, which would include the logic of deriving the value of the Length field, comparing it to the previous length, logging the data, etc.
GetDatabaseTableTriggerSetup(TableId : Integer;VAR Insert : Boolean;VAR Modify : Boolean;VAR Delete : Boolean;VAR Rename : Boolean)
IF TableId = DATABASE::Object THEN
Modify := TRUE;
OnDatabaseModify(RecRef : RecordRef)
IF RecRef.NUMBER = DATABASE::Object THEN
MyLoggingCodeunit.LogLengthChange(RecRef);
Replicating all the new code on an older NAV 2009 would not work, would it?
I would like to use these new database triggers, but the client version is still on 2009.
I'm assuming the client has to "know" that these new functions exist on COD1, so I don't think that even replicating all the code on an older client version would not work. As anyone tried it?
Answers
Below is some example code, which I have NOT tested, so you may need to make changes. the MyLoggingCodeunit would be your custom Codeunit, of course, which would include the logic of deriving the value of the Length field, comparing it to the previous length, logging the data, etc.
I traded my sanity for a railgun
Thanks for the reply.
But I doubt that we have such functions in codeunit 1 (GetDatabaseTableTriggerSetup and OnDatabaseModify).
I am using NAV 2009 SP1 IN Database and I don't see any such triggers.
Did I missed anything? Please suggest
Thanks & Regards,
Saurav Dhyani
Do you Know this About NAV?
Connect - Twitter | Facebook | Google + | YouTube
Follow - Blog | Facebook Page | Google + Page
I traded my sanity for a railgun
I would like to use these new database triggers, but the client version is still on 2009.
I'm assuming the client has to "know" that these new functions exist on COD1, so I don't think that even replicating all the code on an older client version would not work. As anyone tried it?