There was a bug till NAV 2018 CU 1 update that whenever a NAV 2018 extension is published from VS Code, all the data which was inserted earlier gets deleted.
- Microsoft Dynamics NAV 2018 CU 2
- Visual studio code (VS Code)
1. Install Microsoft Dynamics NAV 2018 CU 2
2. Install VSIX Extension for VS Code
- Click on Extension button at the Left corner of VS code.
- Click on the more button ( three dots) and select Install from VSIX. Navigate to the path “CU 02 NAV 2018 NA\NAV.11.0.20348.NA.DVD\ModernDev\program files\Microsoft Dynamics NAV\110\Modern Development Environment” to install VSIX.
3. Open the launch.json file and enter schemaUpdateMode to synchronize
How data synchronization works?
The data synchronization between each publish is controlled by schemaUpdateMode setting, which is specified in the launch.json. This setting consists of two options; Synchronize and Recreate. The default value for schemaUpdateMode is set to the Synchronize mode, which means that every time you publish an extension to the development server, the data you entered previously stays. If you do not want to synchronize the sample data with each publish, you can change the schemaUpdateMode setting from Synchronize to Recreate
When you set the schema update mode to Recreate, all the tables and table extensions are recreated at every publish, which means that all the data in those tables are lost. This means that you will get empty records when you publish your extension.