Posts

Showing posts from August, 2016

X++ job to treverse AOT objects

static void CusLayerTableFieldAnalysis_Cus(Args _args) {     #aot     #properties     Str                         projectName = "DataDictionary_CUS";     ProjectNode                 projectNode;     ProjectGroupNode            ddProjectGroupNode;     ProjectGroupNode            edtProjectGroupNode;     ProjectGroupNode            tblProjectGroupNode;     ProjectListNode             projectListNode;     TreeNode                    memberTreeNode;                 TreeNode                    projectTreeNode;     TreeNodeIterator            projectIterator;       SysDictTable    dictTable ;//= new SysDictTable(tableNum(CustTable));     SysDictField    dictField;     TreeNode        treeNode;     FieldId         fieldId ;//= dictTable.fieldNext(0);     //ProjectNode projectTreeNode = SysTreeNode::getPrivateProject().AOTfindChild('DataDictionary_CUS');       // find all Private projects     projectListNode = SysTreeNode::getPrivateProject();     // fin

X++ job to treverse AOT Tables

static void TreversrAOTTables(Args _args) {     #AOT     Treenode TableNode;     Treenode Table;     str TableName;     str tableConfigKey;     int i;     int nodeCount;     ;     TableNode = treenode::findNode(#TablesPath);     // Count of all the forms.     nodeCount = TableNode.AOTchildNodeCount();     Table = TableNode.AOTfirstChild();     for (i=1; i<=nodeCount; ++i)     {         TableName = Table.AOTgetProperty("Name");         tableConfigKey = Table.AOTgetProperty("ConfigurationKey");         if (tableConfigKey == 'WMSAdvanced')         {             info(TableName);         }         table = table.AOTnextSibling();     } }

Sample code

ReleaseUpdateDB::indexAllowNoDup( new DictIndex( tableNum (TableName), indexNum (TableName, DateEffectiveIndex)));

Dynamics AX Data Upgrade : No upgrade script was registered for the table * field * (relation *). Register an appropriate upgrade script or add the relation to the exclusion list.

Image
During a data upgrade from AX2009 to AX 2012 R3 we face an issue during UnitOfMeasure Upgrade script in AX 2012 Upgrade check list . The error message was as below: No upgrade script was registered for the table <TableName> field <FieldName>(relation <RelationName>). Register an appropriate upgrade script or add the relation to the exclusion list. The info Log generated is as below: After investigating this issue I came to know that the issue was due to Some Custom Tables Which Were having relation with UnitOfMeasure Table and their relation were not added to the exclusion list, and when the script run it add the Relations to the exclusion list for other Standard tables which can be seen in Class "UnitOfMeasureUpgradeValidator" method "registerExcludedrelations". Adding the custom Code to this method resolved the issue :-)

Table Field Mapping

[ UpgradeScriptDescriptionAttribute( "@SYS136813" ), UpgradeScriptStageAttribute(ReleaseUpdateScriptStage::PreSync), UpgradeScriptTypeAttribute(ReleaseUpdateScriptType::SharedScript), UpgradeScriptTableAttribute( 'CompanyInfo' , false , false , false , false ) ] void updateMappingCompanyInfo() { ReleaseUpdateBulkCopyMap::addFieldNameMapping(#companyInfoTableName#dataAreaIdFieldName,#companyInfoTableName,#dataAreaFieldName, NoYes::No); ReleaseUpdateDB::addBulkCopyFieldOption(#companyInfoTableName,#modifiedDateTimeFieldName, ReleaseUpdateBulkCopyFieldOption::DoNotCopy); ReleaseUpdateDB::addBulkCopyFieldOption(#companyInfoTableName, #modifiedByFieldName, ReleaseUpdateBulkCopyFieldOption::DoNotCopy); }