How to Retain data after publishing App

15

Hope you all started app development and may be wondering how to retain data after publishing app or debugging several times or after adding more sample data.

How do I retain the sample data so every time no need to add the same data.  ?????

In Business central you can synchronize the sample data while publishing several times. This can be done by simple settings in launch .json file.

lanuchjson

Once you mention this settings then the  data synchronize is controlled by this settings.

This settings consist of two options i.e. Synchronize and Recreate .

The default value is synchronize which means data will be retain every time when the app get published.

When schemaupdate set to Recreate mode then all the tables and table extensions are recreated every time and data will get lost.

When schemaupdate set to Synchronize then:

Do’s

  1. Add more field in table
  2. Increase length of field.

Don’t

  1. Don’t delete the field which contains sample data as if the field is removed from table then data can not be synchronize
  2. Don’t decrease the length of field for code and text datatype.

For above points you need to write upgrade code units or set schemaupdate to recreate.

In next blog will see how to write upgrade code units.

Stay tuned for more…

 

 

 

 

 

 

 

 

One thought on “How to Retain data after publishing App

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.