Yesterday, after code merger or migrate from Dynamics Ax 2012 R2 to R3, I got very strange errors in AOT Query or static Query. Error was already reported and solved by different MVPs like Martin Darb and Tommy Skaue.
“Field Mismatch in Union Query”.
In code migration, they increased the field length of EDT. For example for Unknown reason In one of customs code, they increase the “Name” EDT from 60 to 120 character. And this result into creating problems in Union Based Queries.
I solved it following way.
- Expand the Union Query.
- Select all views one by one. And check that field on which exception through.
- Expand the query on which view,
- Locate the table, and from field I get the EDT name
- Change the length of EDT and let it synchronize.
- Expand the table and check the field Length.
- Expand the View it shows the old length.
- Expand the query, Right click on it and restored. If length did not reflect change and no customization in View.
- Right click and delete it. View will delete and restored again from Sys layer. New view will shows the update length.
- Compile the query.
Reference : https://community.dynamics.com/ax/f/33/t/103490