Object Manager

Source Control

The chapters below describe the feature set of Source Control page.

 

 

 

Setup


 

Save Compiled Version

Specifies if the fob file of each object is saved to the history. If the compiled version is not saved a rollback is not possible. The folllowing options are possible:

  • Confirm Each Session

  • Always

  • Never

Object File Name Format

Provide the format of object filenames when objects are exported out of the Object Manager.
More info: File Name Forma

Object Management (group of fields)

Use these fields to set up how the program interacts with the NAV object table. You can choose between Finsql and PowerShell.

Branches (group of fields)

Provide a number series format and a description for branches.
More info: Branches

Save C/AL at (group of fields)

Use these fields to set up how the program will save the code of an object to C/AL history when you perform various actions:

  • Modify the object

  • Assign modifications to a project

  • Lock or unlock the object

  • Transport the object

  • Before and after you import a transport
    For each action, you can select three saving options:

  • If Changed – code will only be saved if the object was changed (date or version list differ).

  • Yes – code will always be saved for the action.

  • No – code will not be saved for the action.

 

Compare Tool

Provide the path to Compare Tool that you use for comparing the C/AL code. For example Beyond Compare or UltraCompare. %1 will be replaced with the left file or directory %2 will be replaced with the right file or directory.

Three Way Merge Compare Tool

Provide the path to the Merge Tool that is used when you import a transport Object Import Mode Three Way Text Merge.

C/AL Editor

Provide the path to the C/AL Editor. If not specified the default TXT-editor is used.

Designer (Finsql on Client)

The path to the NAV Development Environment located on the client. This exe is opened where ever you press Design in the Object Manager.

PowerShell


Some OMA users register several NAV instances for the same NAV database. For example, one instance is used for RTC, and the second one is for NAS or web services. In this scenario, when OMA exports objects which contain dotNET references, NAV will pop up a dialog window with the list of available instances and will require to select one of them. In a standard development environment, it is possible to do this manually. But when OMA exports such object(s) on the server in the background, the error will appear.

 

In this scenario, we recommend using the PowerShell option of Object Management Type. This option can be found either on the Object Manager Setup page or on the Database Card page.

If you are using the Database Card for setting up your database connection, you should change this option on the Database Card also. Otherwise, you can do it on the Object Manager Setup page.

Once you change this option from Finsql to PowerShell, OMA will try to update Microsoft.Dynamics.Nav.Server.exe.config file in the Service folder. In most cases, this file is protected. Therefore, OMA is not able to update it automatically. You will be notified about that.

For using the PowerShell option, you will need to configure the NAV service tier and server. Please run PowerShell window as Administrator.

On the server where NAV Service is running, please set the execution policy by typing this into your PowerShell window: Set-ExecutionPolicy RemoteSigned

 

In some cases, it will be required to setup Windows Remote Management (WinRM) service. For this purpose you need to open Command Prompt (as Administrator) and run the following command: winrm quickconfig

 

In the Service folder please open Microsoft.Dynamics.Nav.Server.exe.config file in Notepad or Notepad++ (recommended). The Default path of the Service folder for D365BC is C:\Program Files\Microsoft Dynamics 365 Business Central\130\Service. Find NetFx40_LegacySecurityPolicy option. By default the attribute enabled=”true”. It has to be changed to enabled=“false”.

 

Please close and save the file. After this change you will need to restart your NAV service instance(s).

 

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.

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.

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

 

 

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.

 

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

 

The C/AL History Objects page opens.

 

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.

 

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

Restore an Object

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

 

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

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.

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.

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.

 

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.

 

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.

 

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.

 

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.

Rollback Objects


When you want to rollback object changes you open the Rollback Objects window. Using the Rollback Type you can rollback to a certain date/time combination, for a specific project or specific transport. Go to Source Control > Rollback Objects.

 

  • Date/Time – Enter a date/time combination in the Rollback to field

  • Project or Transport – Enter a project/transport number in the No. field

Object Manager will retrieve all the objects that were changed since that date or for that specific project/transport. Press Rollback to execute the rollback.

 

File Name Format


The Object Manager interacts with files a lot. By default the files are created with the following filename format:

 

In the setup you can enter an Object File Name Format with the following examples.

Examples

<TypeNumber>-<Type>-<Number> <Name>.<ext>

5-Codeunit-45 AutoFormatManagement.txt

<TYPE,3><Number>.<EXT>

COD45.TXT

<TypeNumber,-3>-<Number,-10>.<ext>

005-0000000045.txt

<NameWithoutPrefix,Stripped>.<Type>.al

http://ItemCardForecastExtension.Page.al

<Types>\<Number> <Name>.al

Codeunits\1854 Item Card Forecast Extension.al

The following tables list the predefined formats for each object property.

<TypeNumber>

5

<Number>

45

<Type>

Codeunit

<type>

codeunit

<TYPE>

CODEUNIT

<Type,3>

Cod

<Types>

Codeunits

<Name>

AutoFormatManagement

<name>

autoformatmanagement

<NAME>

AUTOFORMATMANAGEMENT

<Name,4>

Auto

<NameWithoutPrefix,Stripped>

AutoFormatManagement

<ext>

txt

<EXT>

TXT

<ext,0,editor=nav>

nav

 

Branches


A branch is used when your development team needs to work on two distinct copies of a set objects at the same time. With branches it is possible to reserve, group, develop and take a deeper look at selected versions of objects. It makes it possible to work on reserved versions of objects or even develop simultaneously on the same object.

Setup

 

Branch Nos. Format

This is the no. series format used when a new branch is created.

Branch Description

%1 will be replaced by the Branch No.. You can use date expressions like: <Day> <Month Text> <Year4>.

Comments

Comments are similar to Comments in projects.
For more information see Comments.

Documents

Documents in transports are similar to Documents in projects.
For more information see chapter Documents.

Add Objects to a Branch

 

 

You can add different objects to a branch. The current version is retrieved.

 

Or you can add a selection from the C/AL History table to your branch if needed.

 

In the example above you see two lines for the table car. The first one is the latest version. The second line is an older version. It is possible to expand and collapse an object to see only the latest version. In the C/AL History table the branch is added to the selected versions.

 

You can add an object from the Object Explorer and add C/AL History Lines from the C/AL History to a Branch.

Outdated Objects in a Branch

When an object in your branch is not the current version they have a Boolean in the outdated field. There are three possibilities to cope with these conflicts.

 

  1. Get Latest Versions If the version of an object in your branch is outdated a new line for the latest version will be added.

  2. Show Outdated History Objects Shows the latest version of the outdated objects in your branch. This can be used to roll back the objects in the database to the last known version of the branch.

  3. Show Initial History Objects Show the first version of the objects in the branch. This can be used to roll back the objects in the database to the initial state of the branch.

Activate a Branch

When you want to work on a branch and reserve the objects in the branch you can activate it. All objects in the branch will be locked by you. If an object is active in another branch you get an error.

 

If there is an object in your branch that is outdated you get the following error.

 

Because of this two checks it is possible to have an object in more than one branch with totally separated functionality.

 

Repository


Repository is used when you want to save your objects outside NAV. You can save your objects in a repository like TFS or File System. Every time an object will be checked-in in the Object Explorer the object will be send to the repository. You can use the repository with and without synchronization. The option with synchronization is used if you want to sync separated databases. Every change that is done in one database is also executed in all other databases that are connected to the same repository.

Repository without Synchronization

 

Use Repository

Set this flag if you want to use a repository.

Repository Type

The type of the repository. One of the following options can be chosen:

  • File System

  • Team Foundation Server

Repository Path

The local path that the repository is using to save the files.

Username

The username that is used to login to the repository.

Password

The password that is used to login to the repository.

Assign Mods. Before Check-in

Before you check-in an object you have to assign the modifications on this objects to a project. This prevents that these modifications have to be assigned in each database individually.

Export Object Format

  • FOB: Objects will be exported in FOB format. This is a file format with only the compiled version of the object and can be imported with the “Objects Import Worksheet”

  • FOB + TXT: Objects will be exported in OBJ format + TXT format.

  • TXT: The object will be exported in text format. The files will get TXT as extension.

Archive Objects

Each time an object changes a copy of this object will be saved to the archive directory in the repository.

Archive Projects

Each time a project changes a copy of this project will be saved to the archive directory in the repository.

Archive Transport

Each time a transport changes a copy of this transport will be saved to the archive directory in the repository.

Create Repository

When you create a repository all the directories are created in the repository and a token will be placed in the root. The directory structure looks like this:

Export

With this option all objects, projects and transports will be exported to the repository.

Import

This option imports all objects, projects, transports and locks from the repository.

Lock Repository

Locks the repository. This places a file with the name LOCKED in the root of the repository. Nobody can read or write to the repository until somebody unlocks the repository

Unlock Repository

Unlocks the repository. The file with name LOCKED will be deleted from the root of the repository.

Repository with Synchronization

Synchronize Databases

Use this option to enable synchronization between databases.

Last Read Token No.

The token number that is last read. This field is used to prevent that a specific token is read 2 times.

Global Last Token No.

The last used token number of the repository. This is directly read from the repository. If this field is empty then the repository cannot be reached.

Auto Synchronize

Use this option to poll if something changed in the repository. If something changed these modifications are automatically imported in your database and executed.

Seconds Between Auto Sync.

Seconds between each time the repository is checked for new changes.

Token Duration

Seconds that a token is seen as valid. If one of the connected users sees that your token is busy for this number of seconds it is killed and you get a warning that the token duration has to be increased.If you use a repository that is on a WAN or internet then it can be necessary to increase this value.

Delete Log when Processed

Each modification will be saved to a log table. If you enabled this option these records will be deleted after they are processed

Test Connection

The connection to the repository will be tested. If something is wrong you will get a detailed error message.

Connect

Sets the Last Read Token No. to the token number of the repository. Use this option if you want to connect to an existing repository but you do not want to process the log. It is highly recommended to import all objects, projects, transports and locks from the repository before you connect to an existing repository.

Synchronize

This option processes all pending log records.

Check-out and Check-in Objects

If you use a repository it is highly recommended to enable the SQL check that an object can only be changed if it is locked. You can enable this setting in the setup by setting At Modifying Object to Error if not locked. Now it is prevented two developers are working on the same object.

 

Before you can change an object you first have to check-out this object from the repository. You can do that in the Object Explorer by pressing the Lock Object button or Ctrl + L:

 

It is also possible to select more objects at the same time and lock them together. Now you can see that the object gets a blue color. In other databases you can see that the object has a grey color and that the user that has locked the object is shown next to the grey square. What technically happens in the background is that the token has got a new number:

 

A lock file is placed in the locked directory with the credentials of the user that has locked the object:

 

A copy of the locked object is placed in the object directory.

Every modification that involves the repository is logged in the log directory. This is done through FAB files. All the other databases check the token in the main directory and if there are new log files they are imported and processed.

Modifying Project and Transports

If you change a project or transport this modification is immediately saved to the repository. If two developers are modifying the same project the following error appears and the modification is rolled back.

Exporting and Importing

If you export data to the repository it is not placed in the log so it is not automatically read by the other databases.

Exporting and Importing Objects

If you want to ex- or import all objects you can use the functions on the Repository Panel. If you want to ex- or import one object or a couple of objects you can use the repository functions in the Object Explorer.

If you try to import an object that is newer in your database you will be warned.

Exporting and Importing Projects

If you want to ex- or import all projects you can use the functions on the Repository Panel. If you want to ex- or import one project or a couple of projects you can use the repository functions on the Project Card or the Project List.

Exporting and Importing Transports

Similar to ex- and importing projects.

Place Action in Repository

All the data actions that you do with the Action Worksheet can be placed in the repository so that the action will also be executed in all other databases. If e.g. you want to delete a field from a table you first have to empty that field. If you only empty the field in your own database and remove the field all the users in other databases will get the following error.

 

And if they process the log manual they will get the following error.

 

So it is important that you first export an action to empty the field to the repository before you save the object.

Renumber an Object

If you simply rename an object in your database this will not be noticed by the other connected databases and they will try to insert the renamed object which will result in two objects with the same name.

 

And if they process the log manual they will get the following error.

To prevent this it is recommended that you renumber an object always with the Renumber Objects tool and that you copy this renumber action to the repository before checking in your modifications.

Renumber a Field

A field in a table cannot be renumbered if there is data present in this field. If you do so you will get an error like this.

 

If you renumber a field in your own database all the other connected databases will also be confronted with this error. To prevent this you have to use the “Renumber Fields” functionality and copy your renumber actions to the repository.All the other databases will now renumber the field without any problems.

IDYN 2024