When upgrading a old NAV database you sometimes need to transfer data to new tables. With the Upgrade codeunits you can manage this easily.
First you make a TableSyncSetup function where you configure your transfer.
And then you make an UpgradePerCompany or UpgradePerDatabase function where you will do the actual transfer.
But recently I got the following strange error when deleting a table.
The system tells me that there doesn’t exists a new table????
So I checked my code and as you can see I have configured that the “ECF Message Out” table needs to be copied to the “UPG ECF Message Out” table. Correct I thought.
After sometime I figured out that this error must be related to the table action. The system behavior is different when you change or delete a table.
When I change the table definition my upgrade code was good. Only when I delete the table I got the error.
And finally I found my mistake. Instead of coping the records to the new table, I need to move the records.
So I need to change the Mode to Move and my problem was fixed.
In the future I will be aware of this behavoir and I hope you will too.