vendredi 6 avril 2012

copy customer records from one company to another using dynamics ax

static void RecordCopy(Args _args)
{
CustTable custTable1;
CustTable custTable2;
;
custTable1 = CustTable::find('11111');
changecompany('TET')
{
ttsbegin;
buf2buf(custTable1, custTable2);
custTable2.AccountNum = '1234';
custTable2.PartyId = '';
custTable2.PartyId = DirParty::createPartyFromCommon(
custTable2).PartyId;
if (!custTable2.validateWrite())
{
throw Exception::Error;
}
custTable2.insert();
ttscommit;
}
}

Aucun commentaire:

Enregistrer un commentaire