It is quite common these days to work in an environment that combines both C/AL and AL programming languages. However, with the release of Business Central 15, the mixed environment and C/SIDE environment are considered obsolete. If you are a NAV/BC developer working with versions that deal with codebases that use both C/AL and AL, you may encounter problems reading values from a table extension field. In such a scenario, this blog could prove to be useful.
To begin with, I assume the readers are aware of the concept of table extensions. This object type helps us to extend the schema and a few properties of a standard table provided by NAV / Business Central, depending on the version you are in.
With each table extension object, a new SQL table is generated using the “Companion Tables” concept. This new table is linked to the original table using the same primary key fields and includes fields added by the extension object. As a result, the more table extension objects associated with a table, the more SQL companion tables are created. Stefano Demiliani has pointed out the potential impact of increasing table extensions in his blog, but we will not delve into that here.
Although the new fields added via table extensions can be included on pages where the parent table is the source and filtered, they are not visible in the C/SIDE environment. They cannot be accessed using the parent’s record variable. To address this issue, let’s look at a simple example where a new field is added to the Customer table using a table extension object, and the changes are published to the environment.

This field is not visible to the users unless I add it to any existing pages where the source table is Customer.

Now, in order to call this field in C/SIDE and read the value stored in it, I created a generic function which asks 2 parameters, <Customer No.> and <Field No.> (Field in extension) and returns the value stored in it.

Here,
– MyField is a record variable of table Field
– RecRef is a RecordReference and MyFieldRef is a FieldReference variable, respectively.
Be mindful when dealing with multiple extensions of the same table, it can become difficult to access the new fields in the C/SIDE environment at times and also with this approach, we cannot apply filters on extended fields as well.
I hope you found this concept interesting and this blog useful, if yes, please try it out and leave your thoughts in the comments section below.





















