Skip to main content

Posts

Showing posts with the label company

Get the active company in AX 2009 - curExt()

Use the curExt() function to get the active company in AX; static void curExtExample(Args _arg) { str CompanyId; ; CompanyId = curExt(); Info(CompanyId); } You would also use the following with the same results. However, the above is much more elegant. static void curExtExample(Args _arg) { str CompanyId; ; CompanyId = CompanyInfo::Find().DataAreaId; Info(CompanyId); } Take Care!

How to change company from X++

The changeCompany statement is used to alter the database settings to another (separate) company. The syntax of the statement is: changeCompany ( Expression ) Statement Here is the code static void main() { CustTable custTable; ; // Assume that you are running in company ‘aaa’. changeCompany(‘bbb’) // Default company is now ‘bbb’. { custTable = null; while select custTable { // custTable is now selected in company ‘bbb’. } } // Default company is again set back to ‘aaa’. changeCompany(‘ccc’) // Default company is now ‘ccc’. { // Clear custTable to let the select work // on the new default company. custTable = null; while select custTable { // custTable is now selected in company ‘ccc’. } } // Default company is again ‘aaa’. }

Axapta change company

You writing two metot . First method code static void LedgerDataAreaUpdateWhile(Ledgertable  _Ledgertable) {     dataarea           qdataarea;     DataAreaId    eskiDataArea;     Ledgertable TLedgertable ;     LedgerTableInterval  sLedgerTableInterval, tLedgerTableInterval;     recid             hedefrecid;     ;     eskiDataArea = companyinfo::find().dataAreaId;     while select qdataarea where qdataarea.Id != companyinfo::find().KonsilideSirket &&                                  qdataarea.Id != curext() &&          ...