Dynamics AX Blog - Posts from November 2018
These posts are machine-translated.
Create cost center by codeIf you are ever embarrassed to have to create a cost center by code, this job may serve as inspiration: static void createCostCenter(Args _args) { str 30 _costCenter = "0815"; // Cost center id to create OMOperatingUnit omOperatingUnit; NumberSeqFormHandler numberSeqFormHandler; NumberSeq numberSeq; if (_costCenter) { if (!OMOperatingUnit::findName( _costCenter, OMOperatingUnitType::OMCostCenter)) { ttsbegin; numberSeq = NumberSeq::newGetNumFromId( OMOperatingUnit::getNumberSequenceReference().NumberSequenceId); omOperatingUnit.clear(); omOperatingUnit.initValue(); omOperatingUnit.omOperatingUnitNumber = numberSeq.num(); omOperatingUnit.Name = _costCenter; // Id used as name omOperatingUnit.NameAlias = _costCenter; omOperatingUnit.omOperatingUnitType = OMOperatingUnitType::OMCostCenter; omOperatingUnit.LanguageId = CompanyInfo::languageId(); if (omOperatingUnit.validateWrite()) { omOperatingUnit.insert(); } ttscommit; } } } |
|
|
|
|
|
|
If you get a hotfix from Microsoft or a module from a Microsoft partner, you often only get one or more AXMODEL files. And there is often a great desire to know in advance which objects are affected by the import of this file.
Such information can be read with the Microsoft Dynamics AX 2012 Management Shell:
Here's how it looks: