Thursday, October 16, 2014

Copying A Record In Ax 2012



Copying A Record In Ax 2012


This example for only for single company, for multiple company's we go for bufer2bufer()

static void CookBookEX22(Args _args)
{
    MainAccount             mainAccount1;
    MainAccount             mainAccount2;
    ;
   
    mainAccount1 = MainAccount::findByMainAccountId('211100');
    ttsBegin;
    mainAccount2.data(mainAccount1);
    mainAccount2.MainAccountId = '211102';
    if(!mainAccount2.validateWrite())
    {
        throw Exception::Error;
    }
    mainAccount2.insert();
    ttsCommit;
   
}

No comments:

Post a Comment