When Changing a Codeunit Subtype

Since a couple of years codeunits have a property called Subtype. Selecting a specific value for this property changes the behavior of the codeunit, one of them being an extra property added to functions, i.e. FunctionType (for Test Codeunits and Upgrade Codeunits) which defaults to a specific value depending on the Subtype value (see my post NAV 2015 Glance 4: New Functions are Local by Default?).

Now what happens when you change the Subtype of a codeunit? As FunctionType values depend on the codeunits Subtype C/SIDE cannot just leave the FunctionType as is. Let’s try and see.

Scenario 1 – Changing a Test Codeunit to Normal

So we create a test codeunit with a test function:

And change the Subtype to Normal:

Now C/SIDE removes any test artifacts that do make sense in a normal codeunit:

Scenario 2 – Changing a Upgrade Codeunit to Normal

Let’s do the same with a Upgrade codeunit:

I.e. change the Subtype to Normal:

Logically as the in previous case, C/SIDE removes any upgrade artifacts that do make sense in a normal codeunit:

This perfectly makes sense … but for one fact: why aren’t the functions set to local as is the default behavior in NAV 2015? I would prefer that as I wouldn’t want any previous test or upgrade function being exposed outside of this codeunit by default.

What do you think?

BTW

Never observed this before, but this looks somehow awkward, doesn’t it: Subtype v.s. FunctionType? Why is the first having a low cap t and the second upper cap T?

Leave a Reply

Your email address will not be published. Required fields are marked *