Skip to content

Microsoft Dynamics NAV 2013 R2 Error - Unable to Verify Table Changes

What Every Developer Needs to Know

In NAV 2013 R2, Microsoft has introduced multi-tenancy. That means that a corporation that has many companies can split their database into many databases with one set of applications in an application database. The difference allows them a little more flexibility in backing up the databases and other maintenance procedures so that, for example, a world-wide corporation no longer has to take down a certain company during work hours to back up the database for the corporation as a whole. Additionally, completely unrelated companies can operate in a hosted environment with no customizations. But, this also brings changes in how we all (including single-tenant corporations) use NAV.

ArcherPoint’s Faithie Robertson discusses Microsoft Dynamics NAV 2013 R2 Error - Unable to Verify Table ChangesThe greatest change is one that developers and NAV database administrators need to be aware of. When delivering a FOB (export of NAV application objects) that contains table changes to a database, we’re no longer updating NAV in one clean sweep. It’s no longer a matter of updating the objects, and SQL being updated as well. They are decoupled. I’m not a SQL expert so I’ll leave the explanation of what has changed under the covers to Microsoft. You can read about it here in the Microsoft Dynamics NAV blog. (I consider this a must read for NAV developers).

With these changes there has been lots of talk about pre-existing issues where there was a “possibility” of data loss. For that reason, all NAV2013R2 clients should be updated to the latest hotfix versions, including platform hotfix 36310 (per the above linked article).

But even on this version, there are some things you need to understand about delivery of table changes. And the easiest way to explain it is to show you the problem, and then the solution.

The Problem

Using a standard Cronus NAV2013R2 database with platform build 7.10.36310, I’m going to create a table change. I’ll add a new field, “Test Field” to our first table, “Payment Terms”.

Table Change: Add field, Test Field, into the Payment Terms Table in Dynamics NAV…

Figure 1 – Table Change: Add field, Test Field, into the Payment Terms Table in Dynamics NAV…

I’ll exit, save changes and compile. There, field added, right? Well…let’s just see!

I then open SQL Server Management Studio, expand my database, find my table, open the COLUMNS section and…wait a minute! Where’s my field?

…Opening the same table in SQL Server Management Studio shows the new field is not there

Figure 2 – Opening the same table in SQL Server Management Studio shows the new field is not there

In my disbelief, I recheck the Navision table layout and yes, my new “Test Field” is there! What kind of Hocus Pocus is this!

Let’s leave that example briefly and try another. (Yes, wash that off the brain, and let’s just move on.)

Now I try to import a set of FOB’s from my trusted ISV application. I open my brand spankin’ new database and import the FOB, only to receive this error:

Importing a FOB into the database generates an error: “Unable to verify table changes.”

Figure 3 – Importing a FOB into the database generates an error: “Unable to verify table changes.”

What kind of “verify table changes” are they trying to verify? Is something wrong with my ISV’s FOB? No, not at all!

Expecting that something is wrong with the FOB, I export out my Payment Terms table where I have added “Test Field”, and try to import it into my new database. Do I get the same error? No, not at all. The FOB loads completely. Yet, when I check the table in the new database – still no “Test Field”!

The Solution

After a few large doses of acetaminophen, a long conversation with Microsoft Support, and hours of reading blogs and forum posts, I can now tell you how to prevent this from happening. It’s really quite simple, and would have been ever so nice to have had in the Microsoft ‘What’s New’, ‘Release Notes’ or ‘Release Notes Follow Up’ documentation (Microsoft: This is my subtle hint and plea for future NAV version documentations.)

From your Development Client, open Tools – Options. You’ll see a few new settings we need to talk about. Namely those I’ve circled below.

From the Development Client, open Tools->Options to change or set options

Figure 4 – From the Development Client, open Tools->Options to change or set options

First, let’s understand what “Prevent data loss from table changes” will do. If I set this to NO, I can import my ISV FOB without error. But wait – that’s not a solution. Using that method, if you are in a database that has data and are importing a FOB, you can very easily lose data. DO NOT SET THIS TO NO IN A DATABASE CONTAINING DATA. Just don’t do it! There’s not enough acetaminophen in the world to fix that kind of pain!

However, if you are operating in an object-only database, one where you are merging code to be extracted for use elsewhere, and not concerned with table data, feel free to set it to NO. But be reminded that you’ve left the barn door wide open! Database tables can lose data, not be properly updated with table changes, and your database cannot be used to support the application.

Now let’s talk about the fields circled in red in the above image (Server Name, Server Instance Name, Server Port, & Management Port). In all the reading I’ve done to resolve this I caught wind of a little hint at the solution when I was told that we now can pull down on the Database Information screen “Server Instance” field (see below). Hmm…wonder why I’d need to select an instance for development? I never had to do that before.

Selecting a Database Server Instance from the Database Information screen

Figure 5 – Selecting a Database Server Instance from the Database Information screen

Well, after you do this, and then (IMPORTANT PART) click OK on the selected instance that connects to your database, you’ll have populated the Tools – Options page fields related to the Server and Service.

(Note: If you open this page and it doesn’t show any instances, you need to start your instance and be sure your instance is running under the SQL “db_owner” user.)

Opening a database instance populates the fields related to Server and Service in the Tools->Options page

Figure 6 – Opening a database instance populates the fields related to Server and Service in the Tools->Options page

With these fields populated in the Development client, I can now import my FOB containing my change for the Payment Terms table – or of my ISV table changes – and SQL is updated.

Well, SORT OF! Sometimes, for reasons unknown, NAV will not always find the server, even if you have specified the values in the Options. Matt Traxinger, a fellow ArcherPoint employee, ran into this when running tables a lot previously, but it has been a while. Neither he nor Brian Winfrey, another ArcherPoint resource, could determine why it wouldn’t connect.

On my first attempt at this, after re-importing the Payment Terms table change, there was no effect. The field was not added. But if I remove the field from the NAV object (changing the object metadata), then close the database, then reopen the database, I do have “a change” to the table. But it’s not exactly what I asked for. Notice the differences below in my fields in NAV .vs. SQL.

 Difference in the table definitions as seen in NAV...

...and SQL Server

Figure 7a and 7b – Difference in the table definitions as seen in NAV and SQL Server

“So! Now what?” you say. If I add the table in NAV, will it then remove it in SQL? Will my table metadata ever match my SQL database? Should I buy a plane ticket to a foreign country and change my name?

Say Hello to my little friend, PowerShell, and a cmdlet called “Sync-NAVTenant”. No, friends, tenant stuff isn’t just for multi-tenant. It’s for us single tenant folks too.

PowerShell comes as a separate application when you load NAV2013R2. You’ll find it in your Start Menu as “Microsoft Dynamics NAV 2013 R2 Administration Shell” (try saying that fast three times!). When you open the window it looks much like your normal command line window – except some commands are listed right about your entry point. The last one listed is our new friend “Sync-NAVTenant”.

What this little friend does is it makes your SQL database look like your NAV objects. How about that?

Just open PowerShell, type the command and enter.

The next prompt asks for the instance name, so we enter that. (We can find the instance name using the Tools Options page if we’ve updated it using Database Information).

Use PowerShell to synchronize the SQL database and NAV objects

Figure 8 – Use PowerShell to synchronize the SQL database and NAV objects

This runs for a while. How long depends on how many changes have to be made. My suggestion would be to run it EVERY time you import a FOB just to keep yourself in the habit. (Note: You have to be an administrator to run the command. A quick solution in Windows 7 is to right-click and choose “Run as Administrator” when opening PowerShell. If you run it without being an administrator, you’ll get a big blazing red screen of text that basically says you don’t have the permissions required.)

So…long story short (you needed to see the pain that you could inflict on yourself, right?), there are a few things a developer should do when importing a FOB to a NAV2013R2 database that has data.

  1. Set your instance using the Database Information assist edit button, and check your Tools – Options page to assure it has the correct settings (you can also just key these in, but for those of us who don’t want to trust our spelling and typing skills, assist edit is the way to go.)
  2. Run the PowerShell Sync-NAVTenant cmdlet – at least after any table changes but if you do it every time and it becomes a habit, that’s even better.
  3. Never NEVER nEVeR <NeVeR> never make table changes in the Production database. Oh my goodness, just don’t do it! Not only will your users that hit that first application that will sync the tables be ticked off at you (if they know why their job is running slowly, that is), but what if what if PowerShell runs long? What if you do cause data loss? How will you ever know what is lost and how to put it back? Let’s not fool around and test Fate. In the end, if we don’t have data integrity, we don’t have anything.
  4. As the article I linked above suggests, make your table changes in small chunks. Now, I’m not sure what sizing requirements there are to “small chunk”, but it’s safe to say you don’t want to risk reaching your SQL timeout setting (also mentioned in the above article). (Did I mention that was a must read?J)
  5. Go ahead…check SQL. Open Management Studio and check the database table to see if your changes are there. It certainly doesn’t hurt anything!

If you enjoyed this blog, you might like to check out our collection of Development Blogs, as well as our "How To" blogs for practical advice on using Microsoft Dynamics NAV.

Comments

Comment: 
If you can't find the shortcut that opens Powershell with the NAV parameters(I couldn't on my Windows 8 machine), this shortcut will do the trick.
C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell.exe -NoExit -ExecutionPolicy RemoteSigned " & ' C:\Program Files\Microsoft Dynamics NAV\71\Service\NavAdminTool.ps1 '

Comment: 

Hi,
First I want to thank you for very god article.
I tred all yours tips and it didn't solve the problem "Unable to Verify Table Changes". Then I realized that problem might be with my NAV build - I have rollup 5 on every succesful database and rollup 6 on the problematic one.
So, I tried to upgrade to rollup 7, but the problem remained. When I downgraded to build 7.10.36310 (rollup 5), then I solved the problem!

Comment: 

Sasa,

I'm glad you got benefit from the article.  I haven't had the issue you described, but I will note that in Update Rollup 6, Microsoft does give a new DVD Install file.  I'd suggest anyone that wants to update to use that new install file instead. 

Be sure to run powershell Sync-NAVTenant as if your life depended on itsmiley.  Otherwise your SQL tables will not be the same as your NAV tables.  That gives a plethora of issues, as you can imagine.

Thanks for reading!  We keep finding new things with this release and the developer blogs are full of things we've seen. 

- Faithie

 

Read ArcherPoint's Blog Follow us on Twitter Follow us on Facebook Follow us on LinkedIn Link to our RSS feed Join us on Google+ Watch us on YouTube
Get Help Now