Hi,
To get the Current Logged In Company you can Use the curExt() function in AX.
Example :
static void curExtExample(Args _arg)
{
str CompanyId;
;
CompanyId = curExt();
Info(CompanyId);
}
You would also get the same result with below code as well.
static void curExtExample(Args _arg)
{
str CompanyId;
;
CompanyId = CompanyInfo::Find().DataAreaId;
Info(CompanyId);
}
Enjoy DAX!!!
Hello Kuldeep,
ReplyDeleteCompanyId = CompanyInfo::Find().DataAreaId will return the first record in CompanyInfo table. Most likely it will be DAT company. So it shouldn't be used to return the current active company. CompanyId = curExt() should be used instead.
Thank you for your helpful post!
CompanyInfo::Find() returns only from current Company as it does:
ReplyDeleteselect firstonly CompanyInfo
where CompanyInfo.DataArea == curext();
Hello! Discover the power of Microsoft Dynamics GP with our outstanding developers available for hire. In our company, we are proud to associate enterprises with highly qualified GP developers. Trust us to optimize your financial management processes and drive your business to success. >> go to site
ReplyDelete