This blog will describe the significance of the Schema Update Mode and why it is used in Business Central. We were facing some issues while working on the table extensions and realized that we could not change the data type or the size of the custom fields we described in the extension once published.
In Business Central if once we create a table extension and insert some custom fields in the extension once the extension is published and at a later stage, we realized that the data type or the size of the field is not as expected and want to change it. Business Central usually throws an error denoting that the changing of the data type of fields is not allowed.
If we ever realized that we need to make some changes in the fields (may be the data type and size of the fields) after we publish the extension then we can use the “SCHEMA UPDATE MODE” in the launch.json file.
Update Schema Mode consist of 3 options i.e.:
Synchronize
Recreate
ForceSync
SchemaUpdateMode : ForceSync
We can set the Schema Update mode to ForceSync, by default the Schema update mode is set to Synchronize. ForceSyncis very similar to the existing ‘Synchronize’ schema update mode but with more freedom to make schema changes while retaining data. Data will be preserved in almost all cases. The only exception is changing the main table’s Primary Key in which case the data from the extension tables will be lost.
Field renames and changing of datatypes and sizes are allowed and supported in this mode, but the data can only be preserved if we maintain the same ID. If we change both the name and the ID of the field than data will be lost.
SchemaUpdateMode : Synchronise
The default value for schemaUpdateMode is set to the Synchronize mode, i.e. every time we publish an extension to the sandbox instance, the data we would’ve entered previously will be there in the schema. If we do not want to synchronize the sample data with each publish, we can simply change the schemaUpdateMode setting from Synchronize to Recreate.
SchemaUpdateMode : Recreate
When we 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 we will get empty records when we publish our extension every time we make some changes in the extension.
To change the schemaupdate mode to Recreate, follow these simple steps, open the launch.json file. Insert the syntax at the end before the curly braces are closed i.e.
“schemaUpdateMode”:”Recreate”
Hope this helps
ATM Inspection PowerApp to ease ATM inspection and report generation process.
https://www.inkeysolutions.com/microsoft-power-platform/power-app/atm-inspection
Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/drag-and-drop-listbox
Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.
https://www.inkeysolutions.com/microsoft-dynamics-365/dynamicscrmaddons/gdpr
Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/view-creator
© All Rights Reserved. Inkey IT Solutions Pvt. Ltd. 2024
Leave a Reply