View Change Log from Ribbon

The Change Log in Microsoft Dynamics NAV is used to log inserts, modifications and deletions of records. This is very useful and can be an option for the users to see who created the record, what was the value of a field before, when was the last modification made, etc… If it is going to be used this way (and not only for auditing once a month) then you probably want to add an action in the Ribbon to display the Change Log Entries for the record that the user is looking at.

There are two ways to do this; with and without writing any code. We use the customer card as an example.

Without Writing Code

This option is probably the method to choose if you don’t have access to write C/AL code with your license. Although I would never recommend making changes to any objects without writing anything in the documentation trigger (but that is another subject  ).

Open the customer card page in design mode, add an action item to the page and call it ‘Change Log’.


Then go to the properties of the action item and set the following properties.


The Table No. is the table number of the customer table (18) and the Primary Key Field 1 Value is the primary key field from the customer table (No.).

This is it, easy!

With C/AL Code

This option has the advantage that you can just copy/paste the action item between the different pages since it is the same code for all records.

Open the customer card page in design mode, add an action item to the page and call it ‘Change Log’ (same as first option).


Then go to the C/AL code for the action item and add the following code (make the RecRef, the ChangeLogEntry and the ChangeLogEntries local variables).


This is it!

Time to Test It

Now you have a ‘Change Log’ action in the ribbon of the customer card that the users can use to easily see the change log for a selected customer.

To test this we setup the change log to log changes to the customer table, and we set it to log just some of the field. I choose the No., Name and Credit Limit ($). I think logging all the fields in a table like this creates to much ‘noise’ when looking at the log.


We create a customer, and then make a change to the credit limit. After this we test the new button and the change log entries page opens displaying only the changes for the selected fields for this one customer. You see who created the customer record and who have modified the logged fields (and when). Yes, it worked!


A note about the change log; you don’t want to go too crazy with logging all kinds of changes, there is a certain risk that it can affect the performance in the system if you start logging to much changes especially to tables/fields that are updated often. There is a batch job called Delete Change Log Entries, if you use the change log to keep track of who have created what record then you want to make sure you keep relevant change log entries by applying filters when running this job.

The post View Change Log from Ribbon first appeared on Olof Simren - Microsoft Dynamics NAV & 365 Business Central Blog.

Olof Simren - Freelance Microsoft Dynamics NAV Expert

Naviona - Microsoft Dynamics NAV Partner

Comment List