Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How ti get the new fields which is added in standard table in AX 2012 R3 through code

(0) ShareShare
ReportReport
Posted on by 18

Hi all,

Can you please let me know I wants to get the new  fields which is added in standard table in AX 2012 R3.

Could please send me the sample code to get the list of table with new fields. That I need to send to customer.

Please give me more shed on this. 

Thanks!

  • @rp@n Profile Picture
    18 on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    Thanks Nikoloas,

    Its working for me

  • Verified answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    For me it works. Perhaps you just need to recompile your job.

    However the infolog printing causes an error because we did not initialize DictField.

    I fixed it still a bit.

    By the way, next time when you share code, could you please click "Use rich text formatting" -> "Insert" -> "Code". It's much easier to read that way. Thanks!

    static void GDTlistTableFields(Args _args)
    {
        UtilEntryLevel utilEntryLevel;
        UtilIdElements utilfield;
        DictField dictField;
        
    
        while select parentId, utilLevel,recordType, Name, id from utilfield
        where utilfield.recordType == UtilElementType::TableField
        && utilfield.utilLevel == UtilEntryLevel::cus
        && utilField.ParentId == tableNum(CustTable)
        {
            info(strFmt("%1: %2 - %3", utilfield.utilLevel, tableId2name(utilfield.parentId), utilfield.name));
        }
    }

  • @rp@n Profile Picture
    18 on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    Hi Nikoloas,

    i ran that and debugged also. 

    static void GDTlistTableFields(Args _args)
    {
    UtilIdElements utilfield;
    DictField dictField;

    while select parentId, utilLevel,recordType, Name, id from utilfield
    where utilfield.recordType == UtilElementType::TableField
    && utilfield.utilLevel == UtilEntryLevel::cus
    && utilField.ParentId == tableNum(CustTable)
    {

    info(strFmt("%1: %2 - %3", utilfield.utilLevel, tableId2name(utilfield.parentId), dictField.name()));
    }
    }

    here && utilfield.utilLevel == UtilEntryLevel::cus

    it's returned  utilfield.utilLevel = sys

    then it's came out from loop without output.

    TABLECUS.jpgTABLECUS.jpg

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    Sure, just add criteria in the select statement:

        while select parentId, utilLevel, Name, id from utilfield
            where utilfield.recordType == UtilElementType::TableField        
            && utilfield.utilLevel  == UtilEntryLevel::cus
            && utilField.ParentId == tableNum(MyTable)

  • @rp@n Profile Picture
    18 on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    Thanks Nikoloas,

    i ran that , it's hanged basically. i think the reason was it's seraching for all tables in AOT. is it possible to pass one by one table?

    Please give me more shed on his.

    thanks!

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    Actually you can just use the code from my previous link almost as it is. Just remove the part where it searches only for certain data type.

    I didn't test it myself but the code below should show you all table fields from CUS layer. 

    static void listTableFields(Args _args)
    {
        UtilIdElements      utilfield;     
        DictField           dictField;       
     
     
        while select parentId, utilLevel, Name, id from utilfield
            where utilfield.recordType == UtilElementType::TableField        
            && utilfield.utilLevel  == UtilEntryLevel::cus
        {
      
            info(strFmt("%1: %2 - %3", utilfield.utilLevel, tableId2name(utilfield.parentId), dictField.name()));
        }
    }

  • @rp@n Profile Picture
    18 on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    Thanks Andre,

    Shall i use Utilelements and UtilDelements in below code ? how ??

    static void Job1(Args _args)

    {

       SysDictTable    dictTable = new SysDictTable(tableNum(PurchLine));

       SysDictField    dictField;

       TreeNode        treeNode;

       FieldId         fieldId = dictTable.fieldNext(0);

       while (fieldId)

       {

           dictField = dictTable.fieldObject(fieldId);

           if (dictField.isSql() && !dictField.isSystem())

           {

               treeNode = dictField.treeNode();

               info(strFmt("%1 | %2 | %3",

                   dictField.name(),                                               // Field name

                   treeNode.AOTgetProperty("Label"),                               // Label id

                   SysLabel::labelId2String(treeNode.AOTgetProperty("Label"))));   // Label string

           }

           fieldId = dictTable.fieldNext(fieldId);

       }

    }

    Please give me more shed on this.

    hanks!

  • Verified answer
    André Arnaud de Calavon Profile Picture
    294,161 Super User 2025 Season 1 on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    Hi @rp@n,

    There are also system tables called UtilElements and UtilIDElements which can give the information of fields and the layer.

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    Here's one more blog that shows how to find elements by layer: community.dynamics.com/.../x-cross-reference-for-extended-data-types-1618632832

  • @rp@n Profile Picture
    18 on at
    RE: How ti get the new fields which is added in standard table in AX 2012 R3 through code

    Kindly suggest anyone please

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,161 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,942 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans