Version and Source Control

Update C/AL History

Open the Object Explorer and select outdated objects. An object is outdated when the C/AL History is not up to date.

Outdated Objects
Outdated Objects


Press Update C/AL History.

Check and Update C/AL History

The Object Manager only checks if the properties of an object are changed. If you e.g. imported objects with a text file and the date and time of the objects are still the same but the C/AL of the objects is changed the Object Manager will not update the C/AL History. If you know that there are such changes in your database you will have to use the "Check and Update" option. Now the Object Manager will compare the contents of the objects with the C/AL History. This is a time consuming process.

Check and Update
Check and Update

Automatic C/AL Saving

When you perform some actions in the Object Manager it is possible to save the current C/AL to the C/AL History. Go to Setup > Source Control and set the triggers:
  • Save C/AL at Modification
  • Save C/AL at Assigning
  • Save C/AL at Locking
  • Save C/AL at Unlocking
  • Save C/AL at After Transporting
  • Save C/AL at Before Import Transport
  • Save C/AL at After Import Transport

Save C/AL Triggers
Save C/AL Triggers


You can set the 7 different triggers on 3 values: "No", "If changed" and "Yes".
  • Yes - C/AL will be saved always when trigger action is executed.
  • If changed - C/AL will only be saved when the properties (name, date, version) of the object has changed.
  • No - C/AL will not be saved.

Example
If you modify an object with the trigger Save C/AL at Modification on Yes or If changed. you can view the C/AL History with the Object Explorer. In this example we change the length of the field Name from 50 to 200. Save and compile the Vendor table.

Modify the Vendor Table
Modify the Vendor Table


Select the Vendor table and click C/AL History in the Object Explorer.

C/AL History
C/AL History


The C/AL History Objects page opens.

History of the Vendor Table
History of the Vendor Table


In this list you can see all changes in the object from the moment you started tracing. In the example you see the first line is the "original" object, the last line is your last change. The field "Action Type" shows which trigger saved the history. With the button Code you can see the code.

Source Code of the Vendor Table
Source Code of the Vendor Table


C/AL History Lines. To analyze the changes you can use the function Compare.

Compare Two Versions
Compare Two Versions

Restore an Object

In the "C/AL History Objects" page you can restore an object to a previous version. Press Restore.

Restore Object
Restore Object


A new line of Action Type Restore is added to the C/AL History table.

Object Restored
Object Restored

Compare two Versions

Show Last Changes will open your compare tool and show the changes you made compared with the previous version of the object.

Analyze Modifications Made in a Project

You can compare changes of a project by using the function Show Changes in Directory. This function opens the compare tool and shows you the differences in objects and code of the specific project. It is also possible to see the changes in one file. For example if you use UltraCompare which does not have the option of comparing directories.

Changes on Project
Changes on Project

Analyze Modifications Made in a Transport

You can compare changes in a transport by using the function Show Changes in Directory. This function opens the compare tool and shows you the differences in objects and code of the specific transport.

Changes on Transport
Changes on Transport

Analyze Modifications Made in a Period of Time

With the report Compare C/AL Code you can analyze all the modifications that are done in a specific period of time.

Changes in Period
Changes in Period


Changes in Period

Merge C/AL History

With this option it is possible to merge two C/AL History records in an external editor and save your changes automatically back into the database.

There are 2 options:
  • Merge into Old - The oldest C/AL History record will be imported in the database when you are done.
  • Merge into New - The newest C/AL History record will be imported in the database when you are done.

Select the two history records you want to merge and press Merge into New.

Merge C/AL History
Merge C/AL History


The merge tool will open where you can merge the differences. In our example the customer table overwritten by a colleague and your change was lost.

Overwritten Modification
Overwritten Modification


We merge the change into the new version and close the merge tool. Now you see the dialog in NAV that is waiting at your confirm.

Dialog


There are 2 options:
  • Compile - Object will be compiled.
  • Set Modified Flag - The timestamp of the object will be changed to the current date and time and the modify flag will be set. If this option is disabled the date and time of the merged text file will be used.