Van Vugt's dynamiXs

All around NAV dev and test

NAV 2015 Glance 4: New Functions are Local by Default?

It is considered a general coding best practice to declare a function as being local. Over time you could see that the NAV Team was also adhering this, even though C/SIDE wasn't helping a lot on this as new functions would by default be global, i.e. the property Local would be <No> (or you might say undefined). Now with NAV 2015 any new function will get Local=Yes.

Well, that's not always true I found out today by accident when writing my previous post. It appears to be depending on the Subtype of the codeunit.

If Subtype is ...

  • Normal (or undefined, i.e. <Normal>) functions will be local by default
  • Test functions by default be global test functions (i.e. FunctionType=Test)
  • TestRunner we get the same behavior as for Subtype Normal
  • Upgrade functions will default to local upgrade functions (i.e. FunctionType=Upgrade)