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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

xRecord class and common class

(0) ShareShare
ReportReport
Posted on by 30

hi all,

please let me know the xRecord class and common class . i saw the classes are used in stnd. code.

please let me know what is the different between both classes? and when  to use?

i refereed this,but not clear

https://docs.microsoft.com/en-us/previous-versions/dynamics/ax-2012/reference/aa625830(v=ax.60)?redirectedfrom=MSDN 

please elaborate me

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Seems you already found the documentation, and it says:

    "The xRecord class can be seen as the base class for the Common table. The Common table can be seen as the base table for all tables."

    Common is used when you want to have generic handling for table buffers, regardless of the buffer type. Perhaps you have a class and a constructor that takes a Common object as a parameter. Depending on the tableId of common (=which table buffer is actually passed) you can instantiate and return a different child class.

    So, you found the documentation, and you have seen how they are used in the standard code. Do you have any specific questions which were not answered by studying these things?

  • Suggested answer
    Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    Common isn't a class - it's a table. As the documentation says, "The Common table is the base class for all tables. It does not contain any data. It is primarily used in X++ code to refer to any table in a polymorphic way."

    I wonder where you saw xRecord class used in code. As far as I know, it's a kernel implementation of table methods and it's not normally used directly. According to cross-references in F&O, there are just a few places where xRecord is referenced and it's always just to get method names.

  • @rp@n Profile Picture
    30 on at

    I saw common table not xrecord

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    All right, that makes sense (you originally claimed that you "saw the classes are used in stnd. code").

  • @rp@n Profile Picture
    30 on at

    Nikolas,

    Please give me an example of common table. So, that I can understand properly

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    I already gave you an example in my first reply.

    Since you said that you found standard code where Common is used, perhaps you can go where you saw it, and try to figure out how it works. And if you need our help in that, just let us know what code it was.

    Thanks!

  • @rp@n Profile Picture
    30 on at

    Nikoloas,

    static void DataDic_Common(Args _args)

    {

    Common common;

    CustTable custTable;

    ;

    common = custTable;

    if (common.tableId == tablenum(custTable))

    {

    while select common

    {

    info(common.(fieldnum(custTable, name)));

    }

    }

    }

    Let me know why common is used? We can loop directly CustTable rite?

  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Could you please use Rich text formatting - Insert - Code when you share your code?

    Other than that, I don't have anything to add, except to read my previous messages.

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    That's surely not standard code. It's seems to be a job and the code doesn't do anything useful. We can't explain to you code that makes no sense.

  • @rp@n Profile Picture
    30 on at

    Nikoloas,

    Some time we don't know the table I'd or field I'd if any tables. So, with help of common , we can pass the parameters of table I'd and get the value of ( recid ) of actual table. Then we can manipulate that table as per requirement.  

    Is it rite?

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 422 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans