Automatically disable all fields in table in NAV 2013

I am using NAV 2013 and I want to be able to automatically disable all fields that do not apply when I select an option in a particular field on a page.

I am using the employee card page which is customized a bit so that if I select the option Active in the Status field all other fields on the form that do not apply should be disabled.

You can move all the fields in to a group in page

add a global variable

write code in status on validate to make the variable true/false

add the global variable in group editable property

How do I do that ?

You can checkout how this is done on the Item Card page.


Did you follow my advise? Did it help you?

Please can you show me where exactly on the item card ?

Check the OnInit trigger. Here alle the fields are enabled (e.g. UnitCostEnable).

Then you’ll see these two lines with call to an enabler function:

EnablePlanningControls; EnableCostingControls;

in the OnAfterGetRecord and OnNewRecord.

The enabler function then set the fields as either enabled or disabled based on the settings on the item:

EnableCostingControls() StandardCostEnable := "Costing Method" = "Costing Method"::Standard; UnitCostEnable := "Costing Method" <> "Costing Method"::Standard;

Please how do you add global variable to group editable property ?

Hi Eddy,

What??? I’m usually a very patient person, but if don’t you know how to add a global variable in C/AL? Then I really suggest that you go take a basic NAV Development course! I hope you do know that, and I only misunderstood your reply because of language problems! [;)]

Check the variable in the Item Card and see how they are used on the field control properties in your page.

I hope you know how to create a global variable. Create a global variable “e” of type Boolean.

Go into the group properties, where you will find Editable property. Here the default value would be TRUE. In place of true/false you may put “e”. And of course you may code for ‘e’ the way you want it to work.



You must also remember to set the IncludeInDataSet to Yes when you create the EnableField global variable. Just like the xxEnable variables on the Item Card page.