Dear @ron ronnie
Thank you so much for contacting Microsoft Q&A Forum.
Based on your description, I can see that your concern about data loss when publishing a new app in Microsoft Dynamics 365 Business Central Cloud is valid and typically stems from how the schemaUpdateMode is configured during app deployment. Also, you mentioned that you are not using the Recreate option intentionally, but still experiencing data loss, it’s likely that the schemaUpdateMode is accidentally set to "Recreate" in their launch.json or during PowerShell publishing.
I have researched and found several ideas that you can try or consult to see if they can help:
To safely publish an app without losing existing data:
1.Use the Synchronize mode and avoid using "Recreate" unless explicitly needed in dev environments:
- Ensure the launch.json file contains:
"schemaUpdateMode": "Synchronize"
This retains all existing data during publishing.
- If it is in Recreate mode: deletes all data in tables and extensions every time the app is published.
Reference: Synchronizing extension test data - Business Central | Microsoft Learn
2.Avoid breaking schema changes:
If schema changes are needed:
- Use upgrade codeunits to migrate data safely.
- Avoid changing primary keys or deleting fields directly.
You can consult in this link: Debug upgrade and install code - Business Central | Microsoft Learn
3.Use PowerShell for controlled publishing: Use the following commands via Business Central Administration Shell, you can try this to see if it works:
Publish-NAVApp -ServerInstance YourServer -Path ".\YourApp.app"
Sync-NAVApp -ServerInstance YourServer -Name "YourApp" -Version "1.0.0.0" -Tenant "default"
Install-NAVApp -ServerInstance YourServer -Name "YourApp" -Tenant "default"
This method gives more control and avoids unintended schema resets. Reference: Publishing and Installing an Extension - Business Central | Microsoft Learn
Additional notes: you should have a backup data before major changes. Reference: Restoring an environment in the admin center - Business Central | Microsoft Learn
I hope this information can help you in this case and please kindly correct me if I misunderstand your concern.
Wish you a pleasant day!
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.