Microsoft Dynamics 365 Blog

Problem Statement

When you create an add-on solution, you must make sure that the new objects you create are given unique IDs (UIDs) from the range assigned to the add-on in question. This is done by using the appropriate license. There will be no problem as long as only one add-on solution is included in the developer’s license.


However, if the developer’s license includes permission to create more than one add-on solution, it gets more complicated. In this case, the UIDs must be added manually during development instead of allowing them to be added automatically.


One consequence of not manually applying the UIDs could be that two separate add-on solutions are given the same range of IDs. This will generate merge errors when you try to implement the two add-on solutions in the same Microsoft Dynamics NAV database.


Manually setting the UIDs so that they comply with the appropriate add-on UID range is both a tedious and an error-prone task.


The Microsoft Dynamics NAV platform is not able to identify more than one range of unique IDs in a license.


A function (with a fixed, predefined ID) can be added to codeunit 1. This function returns the base UID for the application, much like the SetGlobalLanguage function does for the application language. The function is called whenever Microsoft Dynamics NAV needs to find the base UID for the application. Starting from that base UID, the function finds the next available UID, which is then used for the new function, text constant etc in question.



PROCEDURE GetUidOffset@212122() : Integer;



While creating an add-on solution, a developer at a Microsoft Certified Partner can change codeunit 1 (and restart Microsoft Dynamics NAV or re-open the company they’re working in – because of codeunit 1’s Single Instance-like behavior) to reflect the UID range that was assigned to the add-on in question.



      Exit(Insert add-on solution ID here);



When the partner adds a new text constant, function etc., the C/AL Editor will start at the inserted add-on solution ID and find the next available number.

The procedure for creating an add-on solution and adding UIDs is:

1.       Open Codeunit 1 and add PROCEDURE GetUidOffset@212122() : Integer;. This ensures that you use the appropriate add-on solution ID.

2.       Save and compile.

3.       Open Company.

4.       Start developing ‘Add-on Solution 1’.

5.       Save and compile ‘Add-on Solution 1’.

6.       Change Codeunit 1 – delete PROCEDURE GetUidOffset@212122() : Integer;.

7.       Save and compile Codeunit 1.

You must repeat these steps for each separate Add-on UID range you work with.

Known Issues

·         After this workaround has been implemented in codeunit 1, you must open a company in Microsoft Dynamics NAV before you open the C/AL designer. This is due to the fact that codeunit 1 is not called before you open a company.

·         If this workaround is not implemented when you are developing an add-on solution, the UIDs will be assigned according to the old implementation and might cause problems when you merge more than one add-on solution into a Microsoft Dynamics NAV database.


 – martinni

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!