Using Data method(data()):
static void CreatenewMainaccountwithsamevaluesofanothermainaccount(Args _args)
static void CreatenewMainaccountwithsamevaluesofanothermainaccount(Args _args)
{
MainAccount mainaccount1,mainaccount2;
;
mainaccount1=MainAccount::findByMainAccountId('110110'); //existed main account
ttsBegin;
mainaccount2.data(mainaccount1);
mainaccount2.MainAccountId='9866958'; //new main account
if(!mainaccount2.validateWrite())
{
throw error("Valid
account number shoulb be specified");
}
mainaccount2.Insert();
ttsCommit;
}
buf2Buf method example:
static void
MainAccountCopy(Args _args)
{
MainAccount mainAccount1;
MainAccount mainAccount2;
mainAccount1 = MainAccount::findByMainAccountId('110110');
ttsBegin;
buf2Buf(mainAccount1,mainAccount2);
mainAccount2.MainAccountId = '110111';
if
(!mainAccount2.validateWrite())
{
throw
Exception::Error;
}
mainAccount2.insert();
ttsCommit;
No comments:
Post a Comment