Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

xRecord class and common class

(0) ShareShare
ReportReport
Posted on by

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

  • Sukrut Parab Profile Picture
    Sukrut Parab 71,671 Moderator on at
    RE: xRecord class and common class

    If you are looking for example , you can find plenty of examples in the application  if you do metadata search,  one such a example  you can check is  from application class log inert method. There are plenty of methods on the same class which uses common.

  • Blue Wang Profile Picture
    Blue Wang on at
    RE: xRecord class and common class

    Hi @rp@n,

    The link you see is a bit old, you can combine to look at this system table https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/system-tables#del_companydomainlist

    you will find:

    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.

    Inheritance Hierarchy of Common table is xRecord Class Common Table.

    The inheritance Hierarchy of all other system tables is xRecord Class Common Table (othertablename) Table.

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: xRecord class and common class

    I assume you mean "ID" instead if "I'd" and "right" instead of "rite".

    If you mean that you can have a method accepting a record of any table (by declaring the parameter as Common), than it's correct. If you  know a little bit about object-oriented programming, it should be very familiar.

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: xRecord class and common class

    Not really.

  • @rp@n Profile Picture
    @rp@n on at
    RE: xRecord class and common class

    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?

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: xRecord class and common class

    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.

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: xRecord class and common class

    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.

  • @rp@n Profile Picture
    @rp@n on at
    RE: xRecord class and common class

    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?

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: xRecord class and common class

    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
    @rp@n on at
    RE: xRecord class and common class

    Nikolas,

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

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans