How to update the table column name use upgrade code


I have modified one of a table field name and table object ID. When I upload my new extension to the environment. It returns with error " field xxx unsupported change remove". I was trying to use upgrade codeunit to update the field name. How should I do to handle this situation. The table field(column) name change between the old extension and new extension.

It would help to know what version you are talking about? NAV, BC on-prem or BC cloud?

If BC in the cloud, then you are basically locked, here no schema changes are allowed. So field cannot be renamed. At least not directly, but as you can see in [mention:f55b1e2b610d4a95a0b4a28cb2d20e91:e9ed411860ed4f2ba0265705b8793d05]'s blog, then there is another way:


The same would apply to on-premise, but there you do have the access to force the removal of a field.

Thank you for your replying. I was using BC Cloud. I was adding some prefix for the fields and it would able to publish and said the unsupported error. I was able to published the extension by recreate schemaupdateMode but I would not want to do that. I will try the solution in the link. Thank you so much.

You’re welcome.

This nature of Business Central extensions forces us, as developers, to think much more about our code (especially data / table design), before we put it into production. So I think we are all ending up becoming better developers in BC.

To make things more complex. The old schema is a extension that I made for local publish. I mean “local publish” is use id range from 50000 to 99999 and upload the .app file directly. However, I upload the same extension with App ID to the app source and I have to add prefix for some of the table fields. So it not possible to keep the old fields because the field without prefix in table extension is not allow. Is that mean I have to use another App ID for the app source. Otherwise, I was not able to install the app in the MarketPlace forever?

Not sure I understand you quite. Are you asking what to do, if you have an extension where you’ve used objects in the 50000-99999 range and installed it. And now you have developed the same extension for AppSource using new object numbers?

In that case you would need to create functionality to upgrade/copy your data from the old table to the new. Something which could be done in the installation codeunit.