web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Accessing fields in Table Extension

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I am new to D365FO and this may seem like a silly question. However, any help will be highly appreciated.

I have an extension for base SalesTable, let's say, 'SalesTable.MyExtension' to which I have added few custom string fields. Ex: ReferenceID, DeliveryType etc.

Now if I want to access them from my X++ Code, how do we do that?

SalesTable salestbl;

salestbl.SalesID; => VALID

SalesTable.MyExtension salestblextension; => Throws error

salestblextension.ReferenceID; => INVALID

The error is  "The name SalesTable.MyExtension does not denote a class, a table or an extended data type".

If I need to use the value in my custom fields in a class, how can it be accessed?

Any help is highly appreciated. Please excuse my amateurishness.

Thanks.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Accessing fields in Table Extension

    The extension is applied to the base object in runtime. So you access the fields via SalesTable.MyNewField.

  • Blue Wang Profile Picture
    on at
    RE: Accessing fields in Table Extension

    Hi Isp,

    As Nikolaos said,You just need to call with the original table buff.
    For example, when you create an extension class, you can use it as follows:

    [ExtensionOf(tableStr(SalesTable))]
    final class SalesTable_Extension
    {
        public static boolean isMyFieldEmpty(SalesTable _this)
        {
            return _this.ReferenceID == '' ? true : false;
        }
     
    }

  • Community Member Profile Picture
    on at
    RE: Accessing fields in Table Extension

    I think you are missing a model reference.

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at
    RE: Accessing fields in Table Extension

    To elaborate on Bharath's answer, the packages in X++ are like C# DLLs - you need to reference them correctly.

    SalesTable is in AppSuite. Your extension is in "MyExtension". At this point, only code that lives in "MyExtension" can see your new field.

    From another package, you can reference "MyExtension" - then you would see the field there too.

    Note that you can't go circular of course. So if MyExtension is referencing AppSuite, then AppSuite cannot reference MyExtension - implying AppSuite code can never see your new field.

    Hope that makes sense.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,100

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 890 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 633 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans