Skip to main content

Posts

Showing posts with the label changecompany

Change company example in MSD Ax

 This is a good example to know how to use change company method to get data from multiple companies. CustTable CustTable; ; changecompany('dt1') { CustTable = null; select firstonly CustTable; info(CustTable.Name); } changecompany('dt2') { CustTable = null; select firstonly CustTable; info(CustTable.Name); }

copy customer records from one company to another using dynamics axapta

You can copy customer records from one company to another using dynamics axapta code. This is example of job. You can test this job by directly copy paste to new job in axapta. 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; } }