How to rename records in AX7
In earlier versions of Microsoft Dynamics AX people were used to using the right-click menu in case it was needed to rename the primary key of a record. This post will inform 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 customer 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 in the new Project ID and click OK to continue.
A 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 does not have an index on the related identification field a performance issue can occur in the 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 an effect on the duration of the rename function. - When a table has a Record ID as the 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 set up the table as a 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 in a production environment.
- The option is available to System administrators and the role Information technology manager by default. In case business users should be able to rename records, you can manage this via security permissions. The option is available in privilege Rename unique record keys (SysRenameKey) which is part of the duty Maintain system settings (SysServerSettingsMaintain).
I do hope you liked this post and will add value for you in your daily work as a professional. If you have related questions or feedback, don’t hesitate to use the Comment feature below.
That’s all for now. Till next time!
It’s helpful, thanks!
We have noticed when using this function to rename project it doesn’t seem to update all tables. We have posted time sheets that still have the old project ID! Please use very carefully and test in a dev environment that it updates everywhere you expect it to!
Hi Dave,
Thanks for your input. If table relations are not correct, this type of errors can occur.