Object Renaming Does Not Update Object Metadata

While preparing myself for teaching a NAV Development class in over 8 years I stumbled across this issue various times. As the topic was already on my possible-subjects-to-blog-about list for so long it's clearly time now to write it.

So what's this about?

Never noticed that when you have developed a report or a page and for one reason or another you have to rename it - i.e. change the object id - that when you call the object from RTC you get the following error message:

The Object Metadata does not exist.   Identification fields and values:  Object Type='<object type>',Object ID='<old object id>'

Needles to say that <object type> indicates the type of the object you are calling. However <old object id> clearly shows the former id of this object even though you are calling the renamed object.

Reason

Apparently renaming an CSIDE object does not update the metadata of that object. Having read Lars Lohndorf-Larsen's post on the NAV Team Blog I first thought the Object Metadata table (2000000071) was missing a record for the renamed object. But no, a record for the renamed object was present. Just to check I deleted the record and tried to call the object again. This clearly raises a different error message:

Object of type <object type> with id <new object id> could not be found.

Note that this message references the new object id!

Solution

Nothing special, no rocket science. To get the metadata updated you just have to (re)compile the object, which will update the metadata linked to my object's metadata record in the Object Metadata table (2000000071).

Reference

About Object Metadata, and why I can't see object changes in RTC

Anonymous
  • Even thought the solution to this whole Object Metadata stuff is rather easy, then I think that it's a "stupid" design and not always as handy as it sounds. I have more than once been in the situation where the Metadata somehow has been damaged and then the solution is also recompiling. But if you are in a customer environment then it's not always possible. Example: If the problem with the Metadata is in one of the codeunits which is used by the 3-tier server, then you can only recompile successfully if you do it on a computer which both as the classic client and the 3-tier server installed. And in a production environment, then this shouldn't really be the case. But how many customers have their own test server separate from the production environment?

Related
Recommended