This job is used to find the mandatory fields in the table.
static void Krishh_findMandatory(Args _args)
{ TableId tableId = tableNum(SalesTable);
DictTable dt;
int fieldCnt;
int i;
DictField df;
;
dt = new DictTable(tableId);
fieldCnt = dt.fieldCnt();
for(i = 1; i <= fieldCnt; i++)
{
df = new DictField(tableId, dt.fieldCnt2Id(i));
if(df.mandatory())
{
info("Field '" + df.name() + "' is mandatory.");
}
}
}
static void Krishh_findMandatory(Args _args)
{ TableId tableId = tableNum(SalesTable);
DictTable dt;
int fieldCnt;
int i;
DictField df;
;
dt = new DictTable(tableId);
fieldCnt = dt.fieldCnt();
for(i = 1; i <= fieldCnt; i++)
{
df = new DictField(tableId, dt.fieldCnt2Id(i));
if(df.mandatory())
{
info("Field '" + df.name() + "' is mandatory.");
}
}
}
Good One krish, how to extend this to get all the table (iterate through all the tables) in AX.
ReplyDeleteThanks
Hari