There are many cases when the Dynamics 365 Business Central solution builds without any error or warning but crashes when running an object. It takes much valuable time to debug the problem or find proper documentation with the cases of why the solution could crash.
Nevertheless, we have collected some tips on Dynamics 365 Business Central Extensions build errors, which developers could check when they cannot find the reason why the solution crashes. Those tips worked for us many times, but you have to be sure if this solution fits your situation.
1. Table “Object“ Refactoring
Dynamics 365 Business Central Extensions build errors occur if the object, which you run has:
- Record declaration: ObjectRec: Record “Object”
- Table relation to the system table Object.
Instead of table Object, system table AllObj should be used (or AllObjWithCaption if object caption is used in the solution).
- Find all usages of the Object table and change it to the AllObj table. Fix compile errors (e.g. change field names). You must also fix Get() function, as Primary key of the AllObj table differs from the Object table:
- Object table PK: Object Type, Company Name, Object ID.
- AllObj (AllObjWithCaption) table PK: Object Type, Object ID.
2. Autosplitkey
Dynamics 365 Business Central Extensions build errors may occur if the page which you are running has Autosplitkey property set, and its primary key last member is not of the type integer of decimal. If the object crashes after deleting Autosplitkey property, try setting it to false.
3. DataCaptionExpression
If the standard page crashes, check if it does not have DataCaptionExpression set both in standard and extension. This may be the reason for the problem. Modification is allowed only if DataCaptionExpression is set in standard object or extension.
4. Modified field TableRelation
Dynamics 365 Business Central Extensions build errors may occur if standard field TableRelation property is modified, and custom code is added to one of that field triggers.
5. RoleCenter subpage
RoleCenter subpage extension is not available in Business Central. RoleCenter subpages are CardPart type pages that have CueGroup controls (e.g. P9068 Project Manager Activities).
6. BlankZero
Dynamics 365 Business Central may crash if the standard table field has a BlankZero property set, and it is modified in the table extension. This field change is only allowed if the standard field didn’t have this property.
7. DataCaptionExprCode
Dynamics 365 Business Central Extensions build errors may occur if the standard table field has a DataCaptionExprCode property set, and it is modified in the page extension.
8. SystemPart
Business Central may crash if SystemPart controls Editable property changes. So if you get strange errors, don’t forget to check SystemPart controls in pages.
9. Enum in the Filter expression
Dynamics 365 Business Central Extensions build errors may occur if the Enum is used in the Filter expressions. Typically, it shows an error similar to this one: Unexpected value ‘EnumType’ of type ‘Microsoft.Dynamics.Nav.CodeAnalysis.BoundKind’”. If you see something similar on the build process, check your Enum usages.
10. Translation File
In C/AL, symbol ‘&’ was used to create RTC shortcuts. However, this symbol will not work in AL translation files, and all the places where it shows up should be replaced with ‘&’.
Translaton file must look like this:
<source>F&unctions</source>
<target>Fu&nktion</target>
So there are some of the Dynamics 365 Business Central Extensions build errors cases that we found during extensions development. Maybe you ran into similar cases too? I hope these tips will save you some time during extensions development.