insert record on error

i would like to insert a record into a table as a log, whenever a process in navision runs into an error. how can this be done? i have thought of using commit statement? i insert a record into another table, if an error occurs as this would initiate rolback in navision, and would eventually roll back the record that was meant for logging the error. is there anyway, to do a “partial commit” or a specific commit on a record?

The COMMIT function is a “blanket” function and cannot be limited to the range of tables or records to which it applies. One method you could use would be to create your log record in an external non-Navision-database file. Not elegant, but sometimes "not elegant’ is the simplest answer.

There is also an easy way using an internal database, but it will not give you all the information you probably want to keep: BEFORE the process you want to run, insert the log error on the errors table and use COMMIT. If all goes correctly, after running the process you can delete that error entry on the log table… else the error remains on the log table :slight_smile:

i am trying another method. i will use clearall to clear all the variables in the codeunit, before i insert a record in a log table and commit. logically this should work, but i have yet to try it out yet.