Dynamics AX Blog - Dynamics AX 2012 - Page 9
These posts are machine-translated.
Currently, only posts are displayed, which are relevant for Dynamics AX version »Dynamics AX 2012«
RSS-Feed of this version
RSS-Feed of this version
Search project names for a specific stringTo list all (shared-) pojects that carry a specific text in the name, you can use the following code. static void searchProjectName(Args _args) { ProjectNode projectNode; #AOTExport projectNode = infolog.projectRootNode(); projectNode = projectNode.AOTfindChild(#expProjectShared); projectNode = projectNode.AOTfirstChild(); while(projectNode) { setPrefix(projectNode.name()); if(strScan(projectNode.name(), "BR_", 0, 60)) { info(projectNode.name()); } projectNode = projectNode.AOTnextSibling(); } } |
Update explosion for production orderWith the help of the following job you can update the explosion of a production order. This must at least have the status "Estimated". static void reqCalcExplode(Args _args) { ReqCalcExplodeProd reqCalcExplodeProd; ProdTable prodTable = ProdTable::find('P000272'); ; // Copied from ReqCalcExplodeProd::newProdTablePrompt() reqCalcExplodeProd = ReqCalcExplode::construct(ReqRefType::Production); reqCalcExplodeProd.parmRefType(ReqRefType::Production); reqCalcExplodeProd.parmRefId(prodTable.ProdId); reqCalcExplodeProd.parmInventTransOriginId( InventTransOriginProdTable::findInventTransOriginId(prodTable.DataAreaId, prodTable.ProdId)); reqCalcExplodeProd.parmReqPlanId(ReqPlanSched::defaultDynamicId()); reqCalcExplodeProd.parmReqCalcUpdate(ReqCalcUpdate::NetChangeMinimized); reqCalcExplodeProd.parmMarking(true); reqCalcExplodeProd.parmReqPlanData(null); reqCalcExplodeProd.run(); }
|
Restore DIXF/DMF entitiesI recently had the problem, that all DIXF entities have been deleted in an environment. By following job I was able to restore them. // Based on ClassesDMFDataPopulationcreateDefaultMapping static void RecreateDMFEntities(Args _args) { boolean isFound; DMFEntity dmfEntity; TmpDMFEntityList entityDescription; Counter c; entityDescription = DMFDataPopulation::getEntityList(); ttsbegin; while select entityDescription { dmfEntity.EntityName = entityDescription.EntityLabel; dmfEntity.EntityTypeName = entityDescription.EntityName; dmfEntity.Mdm = NoYes::No; isFound = dmfEntity.defaultModule(dmfEntity.EntityTypeName); if (isFound) { if (dmfEntity.validateWrite() && ! DMFEntity::find(dmfEntity.EntityName)) { dmfEntity.insert(); c++; } } } ttscommit; info(strFmt("%1 entities created.", c)); } |
Create a list of favorites from current userstatic void listFavoritesOfCurrentUser(Args _args) { TreeNode treeNode; TreeNodeIterator iterator; TreeNode newTreeNode; int level; #AOT void loopChilds(TreeNode _treeNode) { level++; while(_treeNode) { info(strRep(" ", level-1) + any2str(SysLabel::labelId2String2(_treeNode.AOTname(), Global::currentUserLanguage()))); loopChilds(_treeNode.AOTfirstChild()); level--; _treeNode = _treeNode.AOTnextSibling(); } } treeNode = infolog.userNode(); iterator = treeNode.AOTiterator(); treeNode = iterator.next(); if (treeNode) { treeNode = treeNode.AOTfirstChild(); if (treeNode) { setPrefix(treeNode.AOTname()); loopChilds(treeNode.AOTfirstChild()); } } } |
Read/modify registryFollowing job demonstrates, how you can read/modify registry entries. static void readWriteRegistry(Args _args) { int regKey; container cRegValue; str regKeyValue; #WinApi // Read regKey = WinAPI::regOpenKey(#HKEY_CURRENT_USER, @"SoftwareMicrosoftDynamics6.0", #KEY_QUERY_VALUE); cRegValue = WinAPI::regGetValue(regKey, @"BuildVersion"); if(conLen(cRegValue) > 0) { regKeyValue = conPeek(cRegValue, 1); info(strFmt("%1", regKeyValue)); } WinAPI::regCloseKey(regKey); // Write regKey = WinAPI::regOpenKey(#HKEY_CURRENT_USER, @"SoftwareMicrosoftDynamics6.0", #KEY_QUERY_VALUE); cRegValue = WinAPI::regGetValue(regKey, @"BuildVersion"); if(conLen(cRegValue) > 0) { regKey = WinAPI::regOpenKey(#HKEY_CURRENT_USER, @"SoftwareMicrosoftDynamics6.0", #KEY_WRITE); WinAPI::regSetValueEx(regKey, @"BuildVersion", 1, "Build: 6.3.164.0"); } WinAPI::regCloseKey(regKey); } |
|
|
|
|
|
|
Anyone who has the need to get the available designs of a SSRS report, can use the following job.