Change Field Type in Dynamics 365 for Finance and Operations
We’ve all been there. Sometime after completing a feature, you decide that a field on a table would really work better if it were of a different type.
For example, you created a string field and now wish you had used a RecId.
On your development machine, the fix is simple; you delete the column and re-add it using the new data type.
It isn’t until your co-workers sync this change from version control that the problem becomes evident. As they synchronize their databases, they will see errors stating that the field type cannot be changed.
Back in the Dynamic AX 2012 days, you could simply drop the table or the field, synchronize the database and you were up and running again. To change field type in Dynamics 365 for Finance and Operations, this doesn’t work; you must also remove references to it from the SqlDictionary table.
If you find yourself in this situation, and you are NOT in your production environment, follow these steps:
1. Drop the table containing the re-typed column.
DROP TABLE [dbo].[LEVGRADEFACTORCATEGORIES]
2. Delete all references from SqlDictionary.
DELETE FROM SQLDICTIONARY WHERE TABLEID IN ( SELECT TABLEID FROM SQLDICTIONARY WHERE NAME = 'LEVGRADEFACTORCATEGORIES' AND FIELDID = 0 )
Restart IIS.
Run the synchronization command.
Under the terms of this license, you are authorized to share and redistribute the content across various mediums, subject to adherence to the specified conditions: you must provide proper attribution to Stoneridge as the original creator in a manner that does not imply their endorsement of your use, the material is to be utilized solely for non-commercial purposes, and alterations, modifications, or derivative works based on the original material are strictly prohibited.
Responsibility rests with the licensee to ensure that their use of the material does not violate any other rights.