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.
WHERE TABLEID IN (
WHERE NAME = 'LEVGRADEFACTORCATEGORIES'
AND FIELDID = 0
Run the synchronization command.