BaIS #3: Pages and Controls with Duplicate IDs

Today we ran into some strange behavior of NAV pages. It all started with the following error message when my colleague Paul opened PAG42 (Sales Order):

Impressive, isn’t it?

After various detours we found out that this page had a duplicate of the following ActionGroup:

Error on Duplicate ID

Less then two months ago we switched from developing in a central NAV database to Team Foundation Server with the consequence that all code is stored in .txt files, but also having the availability over source control including branching and merging, being one of the main reasons for this switch. Of course we still have to learn and experience all strengths and weaknesses. Today, apparently, we were confronted with one weakness today as the issue was caused by an automatic merge where the duplicate (group of) controls where not identified.

Nevertheless the issue as such can happen when editing CSIDE objects in .txt format as any text editor will allow much more than CSIDE’s objects editors. The stunning thing however is that, as you might have wondered already, PAG42 could be compiled. No error was thrown by CSIDE regarding the use of duplicate IDs on that page. Whereas CSIDE does throw errors for any duplicate ID on a form. So PAG42 could be compiled and only on run time an error was thrown.

Example

As PAG42 is quite complex I wanted to create a simple example and toke PAG4 (Payment Terms). I exported the object in .txt format. and duplicated the only action list that resides on that page:

    ActionList=ACTIONS
    {
      { 1900000004;0 ;ActionContainer;
                      ActionContainerType=ActionItems }
      { 19      ;1   ;Action    ;
                      CaptionML=ENU=T&ranslation;
                      RunObject=Page 756;
                      RunFormLink=Payment Term=FIELD(Code);
                      Promoted=Yes;
                      PromotedCategory=Process }
      { 1900000004;0 ;ActionContainer;
                      ActionContainerType=ActionItems }
      { 19      ;1   ;Action    ;
                      CaptionML=ENU=T&ranslation;
                      RunObject=Page 756;
                      RunFormLink=Payment Term=FIELD(Code);
                      Promoted=Yes;
                      PromotedCategory=Process }
    }

Then I imported the .txt file again into CSIDE. This is already strange as this would not be able with forms containing duplicate IDs!

Of course I had to compile PAG4 – no problem – and ran it. Even more stunning: I could simply run the page! [:S]

I double checked if I was running the right database on my NAV Server!

Page Editor

I did some additional checks on the Page Editor:

  • Duplicate the same actions on PAG4 in the editor, by a simple copy and paste
    result: indeed the controls are duplicated, but the system assigns them a unique ID based on your license and GetUIDOffset function in COD1 -> OK
  • Change the ID of the duplicate controls to the same value as there ancestor
    result: the system does not allow you to that and will revert to the previous value of the ID -> OK

Conclusion

It seems MS has not taken into account this scenario (although it is common behavior with respect to forms) and leaves us with an extra responsibilty/burden when merging changes in pages in TFS. [:^)]

Update 20110419

Today I posted this issue on msconnect. Want to give your vote to it? Click here.

Update 20110826

It took some time but the msconnect post has been handled by MS and considered a bug. Click here to read Stuart’s reply.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *