Skip to main content

Posts

Showing posts with the label ttsbegin

How to update funding Source for Project Contract in Ax 2012

If you want to  update funding Source for Project Contract in Ax 2012 by code then you can get idea from below code.  These all standard table. ProjFundingSource projFundingSource; ProjInvoiceTable projInvoiceTable; LogisticsLocation logisticsLocation,logisticsLocationNew; ; ttsBegin; while select projInvoiceTable order by ProjInvoiceProjId desc { if(projInvoiceTable.ProjInvoiceProjId != "S_002834") { if(projInvoiceTable.fundingSourceName() != "") { while select forUpdate projFundingSource where projFundingSource.ContractId == projInvoiceTable.ProjInvoiceProjId { projFundingSource.FundingSourceId = projInvoiceTable.fundingSourceName(); projFundingSource.InvoiceLocation = 0; projFundingSource.update(); } } } else break; } ttsCommit;

How to change Company of Employee in Axapta by code

To change Company of Employee in Axapta by code you can get hint by below code. Its tedius task to update you need to do it very carefully and understand then code then apply in your customization. ttsBegin; hcmWorker=hcmWorker::findByPersonnelNumber(Personalumberid); select companyinfohsd where companyinfohsd.dataAreaId=="dat"; select companyinforss where companyinforss.dataAreaId=="ceu"; select forupdate hcmEmployment where hcmEmployment.Worker==hcmWorker.RecId && hcmEmployment.LegalEntity==companyinfohsd.RecId; hcmEmployment.LegalEntity=companyinforss.RecId; hcmEmployment.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction); hcmEmployment.doUpdate(); ttsCommit;

How to modify funding Source for particular Project contract In Ax 2012

How to modify funding Source for particular Project contract in Project Module. Below is the code sample to get Idea for the same. ProjFundingSource projFundingSource; ProjInvoiceTable projInvoiceTable; LogisticsLocation logisticsLocation,logisticsLocationNew; ; ttsBegin; while select projInvoiceTable where (projInvoiceTable.ProjInvoiceProjId != "PROJ_002834") { while select forUpdate projFundingSource where projFundingSource.ContractId == projInvoiceTable.ProjInvoiceProjId { projFundingSource.FundingSourceId = projInvoiceTable.fundingSourceName(); projFundingSource.InvoiceLocation = 0; projFundingSource.update(); } } ttsCommit;

Example of doupdate in MSD axapta

To update records forcefully in table you can use doupdate method with tablename. Following example is helpful to understand this thing . InventTrans _inventTrans; ; ttsbegin; while select forupdate _inventTrans where _inventTrans.RecId == 5637152999 { _inventTrans.inventDimId = '123213'; _inventTrans.doUpdate(); } ttscommit;

ttsBegin and ttsCommit in MSD axapta

You can use ttsbegin and ttscommit with ttsabort following way. You can try in job public boolean myMethod() { try { ttsBegin; select forUpdate myTable; myTable.fname = testt_; myTable.update(); ttsCommit; } catch(exception::Error) { ttsabort; return(false); } return(true); }