In earlier versions of Microsoft Dynamics AX people were used to use the right-click menu in case it was needed to rename the primary key of a record. This post will tell you about renaming records in the current version of Microsoft Dynamics AX (aka AX7).
What is the renaming feature?
Every table needs to have a primary key to have records unique and identified. In e.g. the customers table, the account number is unique and cannot be inserted with the same value twice. In some rare cases you could be in the need to rename records. When you rename the primary key, all related tables will be looped and the new key will be replaced in these tables as well. Suppose you are changing the Project ID of a project, then all related hour transactions, revenue transactions, etcetera are also changed with the new ID. So the database will be kept consistent.
The former life
In the past we could open the right-click menu from a field and choose the option Record info. The form Record information is opened and when the table supports renaming and you have the correct permissions you can rename the record.
Rename records
When you now use the right mouse button, there is no option displayed to show the Record information form. Is the feature still supported?
The answer is yes. On each form in Microsoft Dynamics AX, there is a menu item Record info on the OPTIONS menu tab page.Click on the Record info button to get the next dialog presented:
The dialog gives you also the option to show all fields or view database log records related to a certain record. These options were also available in Microsoft Dynamics AX 2012. Click on the Rename button to change the Project-ID in this example.Fill the new Project ID and click OK to continue.
A latest confirmation will be asked before the record will be renamed. Click Yes to proceed.You will notice that the project has been renamed and when you check related transactions, these are also changed.
There is more...
To end with this blog, I would also give some important notes related to this functionality.
- As related records will be changed to reflect the new record identification, this can take some time. Especially when there are a large number of records.
Also if a related table is not having an index on the related identification field a performance issue can occur in case of many records.
If you rename records in a global table, all companies will be looped to change related records in other tables. A large number of companies can also have effect on the duration of the rename function. - When a table has a Record ID as primary key with a natural key field, you will be presented to rename a Record ID. An example is the Worker table. You cannot rename the Personnel number.
- If you want to rename an item number, there is an additional check if you have setup the table as scheduled job. In that case it is not allowed to change the primary key.
- The rename function relies on table relations defined on tables in the development environment (Visual Studio). If a table relation is missing, tables might be skipped causing inconsistent data.
- Always test if the rename function is working correctly and really all related tables are changed accordingly in a separate environment before doing this is a production environment.
@Rahul Talasila
No comments:
Post a Comment