Critical Rename Error in v4.03 SQL

rocatis
Member Posts: 163
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.
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
Senior NAV Developer
Elbek & Vejrup
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions