donderdag 14 januari 2010

How to export/import from SysLastValue table

Recently, I was troubleshooting an issue related to user settings. i.e. There was a requirement to migrate the user settings from one environment to another.

As we all know, User related setups for queries, forms, reports etc are stored in SysLastValue table. This is a system table and can't be accessed directly through AOT.

Solution:

NOTE: PLEASE BACK UP YOUR SYSLASTVALUE TABLE BEFORE YOU ATTEMPT THE BELOW STEPS AND TRY TO VALIDATE THE STEPS FIRST IN A TEST/SANDBOX ENVIRONMENT

1. Created a definition Group for SysLastValue table

2. Filter only for SysLastValue table

3. Set up the filter criteria For export in our case we have to do for one user

4. Note that at this point when we do the export, the .dat and .def file which is generated won't be having any data in it. This is because by default the System tables are not included in the Standard Export/Import Wizard of AX.

We need to do a small code change inorder to achieve this, Go to AOT > Classes > SysDataExpImp

5. Modify the candoTable method inorder to comment out the code which does the system table check for SysLastValue

6. Now, once again do the export and there you go..

Initially, I tried to do the SQL way, but figured out that it doesn't work and moreover SQL is not the correct way as we can miss out on Recids.