microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
718 stars 242 forks source link

AllowInCustomizations = Never, gives no compiler warning when field is still used #7771

Open sybrenwille opened 2 weeks ago

sybrenwille commented 2 weeks ago

1. Describe the bug When you set AllowInCustomization to Never the field cannot be used in page customizations. However you can still add the field to a page or page extension without a warning from the compiler. The field is however not visible. This happens in extensions themself and also when you add a field from a dependend extension

2. To Reproduce Create a table field with AllowInCustomization set to Never Add the field to a page. No compiler Error/Warning/Info appears. Publish the extension The field is not visible on the page, and can also not be added

3. Expected behavior I Expected a Warning from the compiler that a field is used on a page that is not allowed because of AllowInCustomization.

4. Actual behavior There is no indication that a field is used on a page that will never appear. You can only check this in the client itself.

5. Versions:

List of Visual Studio Code extensions that you have installed:

pri-kise commented 1 day ago

I've stumbled over this issue today, too. To be honest - in my opinion the current behaviour is a bug. We should be able to add a Field with the property to a page via a PageExtension, but still disallow to add the field via customization.

e.g. Imagine the following (very common) scenario. A field is added to the SalesLine or the SalesHeader. The field has only a valid meaning in the conext of a Sales Invoice. Therefore we add this field via PageExtension to those places. Furthermore we don't want users to add those fields to any other page (e.g. Sales Order) via customization. Then I would expect that I can sett the property AllowInCustomizations to Never and still see the field where it's added via a PageExtension.

Here is small exmaple of this scenario. https://github.com/pri-kise/msdyn365bc-allowincustomizations-test