How to Check UserDefine or SystemDefine field in table in Ax 2012

Description:-

In this Example we will see how many field are user define and how many fields are system define in table. By achieving this functionality we will check by job in ax 2012.
Let’s Create Table and add some field in table.

Create Table Name it “A_Student”.
  • Expand AOT Node.
  • Open Data Dictionary Node.
  • Select Tables and right Click Select New Table.
  • Name it “A_Student”.
  • Now open table in Insert Some Data in A_Student table.


Now create job and code for check how many field are user define and how many fields are system define in table.

Create Job from AOT

  1. In the AOT, click Job.
  2. Right-click the Job node, and then select New Job.

static void SystemClassesFields(Args _args)
{
    SysDictTable dictTable;
    DictField dictField;
    Common common;
    Counter counter;
    ;
    dictTable = new SysDictTable(tableNum(A_PO));
    for (counter=1; counter<=dictTable.fieldCnt(); counter++)
    {
     dictField = new DictField(dictTable.id(), dictTable.fieldCnt2Id(counter));
     if (dictField.isSystem())
     {
       info(strfmt("System field: %1", dictField.label()));
       info(strfmt("System field: %1", dictField.name()));
     }
     else
       info(strfmt("User field: %1", dictField.label()));
     }
     if(dictField.isSql())
     {
      info(strfmt("sql field: %1", dictField.label()));
    }
}

Now run your job by pressing F5 and their you can see fields Information.

Related Posts

Previous
Next Post »

Thanks for comments.....