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!
Thanks Nikoloas,
Its working for me
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)); } }
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.
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)
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!
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())); } }
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!
Hi @rp@n,
There are also system tables called UtilElements and UtilIDElements which can give the information of fields and the layer.
Here's one more blog that shows how to find elements by layer: community.dynamics.com/.../x-cross-reference-for-extended-data-types-1618632832
Kindly suggest anyone please
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156