Merging records
Many times users will unintentionally enter duplicate data into the system. NAV doesn't offer a built-in way to merge this data, but here we will show you how you can do it yourself.
Getting ready
If you do not have two customer records that you would like to merge together, you must create them. It is best if these customers have some related entries in other tables, for example the Contact or Cust. Ledger Entry tables.
How to do it...
Create a new codeunit from Object Designer.
Add the following global variables:
Name
Type
Subtype
Length
CustToKeep
Record
Customer
CustToRemove
Record
Customer
CustNoToKeep
Code
20
CustNoToRemove
Code
20
Add the following code to the
OnRun
trigger of your codeunit:CustNoToKeep := 'C00010'; CustNoToRemove := 'C00020'; CustToKeep.GET(CustNoToKeep); CustToKeep.DELETE; CustToRemove.GET(CustNoToRemove); CustToRemove.RENAME(CustNoToKeep);
Save and close the codeunit.
How it works...
First, you have to determine the two customer records...