Wednesday, July 19, 2017

Main Account Dimension update

static void MainAccountDimension(Args _args)
{
LSVVendInvStageTmp LSVVendInvStageTmp;
    MainAccountLegalEntity  MainAccountLegalEntity;
    MainAccount             mainaccount;
    CompanyInfo                         companyInfoList;
    Ledger                              ledgerList;
    MainAccountLegalEntity              mainAccountLegalEntityList;
    ;
    while select *from mainaccount
    {
   
         while select DataArea from companyInfoList
            join RecId from ledgerList
                where ledgerList.PrimaryForLegalEntity == companyInfoList.RecId &&
                    ledgerList.ChartOfAccounts == mainaccount.LedgerChartOfAccounts
            notexists join RecId from mainAccountLegalEntityList
                where mainAccountLegalEntityList.LegalEntity == companyInfoList.RecId &&
                    mainAccountLegalEntityList.MainAccount == mainaccount.RecId
        {
            MainAccountLegalEntity.clear();
            MainAccountLegalEntity.MainAccount          = mainaccount.RecId;
            MainAccountLegalEntity.LegalEntity          = companyInfoList.RecId;
            MainAccountLegalEntity.DefaultDimension     = 5637144576;
            MainAccountLegalEntity.FixedDimensions      = 0;

            MainAccountLegalEntity.insert();
        }
    }
}

Thursday, July 13, 2017

Connect two DB

select sl4.salesid,sl4.itemid,sl4.LINENUM,sl4.CREATEDDATE from I5Production.dbo.SALESLINE as SL4
where NOT EXISTS

( select SL12.salesid,SL12.ITEMID,SL12.LINENUM From AxDev.dbo.SALESLINE SL12
where  sl4.salesid = SL12.salesid
and sl4.itemid = SL12.ITEMID
and sl4.LINENUM = SL12.LINENUM
and sl4.DATAAREAID = SL12.DATAAREAID
and  sl4.DATAAREAID = 'i5d'
--and  sl4.CREATEDDATE > '2015-12-31'
--and  sl4.SALESID ='S10099614'
);

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...