Has anybody else noticed that it is possible to rename a customer record in v4.03 on SQL to <BLANK>? The same is true for vendors and all other tables with a single field as primary key, but only if the NotBlank property on the field is No.
The same is not possible in the native client - it fails with the error "You cannot rename a record because the new value for the following field is ''". I suspect this error is generated by the native server (which is used even if you're running a stand-alone client) and that the same check is not done by the SQL Server.
The result is quite catastrophic: the rename is carried out as you would expect, except that the customer no. (e.g.) is now blank. Unfortunately, the same is true for the field "Customer No." on all of the customer's ledger entries. Even more unfortunate, this is the same method NAV uses when you delete a customer: it keeps the entries but blanks "Customer No." on all of them.
Basically, if you have ever deleted a customer, you now need to manually figure out which entries belong to the renamed customer as opposed to the deleted customers. And you need to update those entries along with the number on the customer in order to restore the mess.
You can't just change the NotBlank property on the primary key field because that renders the number series management inoperable.
What you need to do is to put code in the OnRename trigger for all relevant tables and check, that the record is not renamed to <BLANK>.
The error seems to be fixed in NAV 2009; I haven't tested v5.
Brian Rocatis
Senior NAV Developer
Elbek & Vejrup
0