4 Apr 2013

ttsBegin and ttsCommit in axapta

ttsBegin: marks the beginning of a transaction. This ensures data integrity, and guarantees that all updates performed until the transaction ends (by ttsCommit or ttsAbort) are consistent (all or none).

ttsCommit: marks the successful end of a transaction. This ends and commits a transaction. MorphX guarantees that a committed transaction will be performed according to intentions.

Note:It is usually better to use exception handling instead of ttsAbort. The throw statement automatically aborts the current transaction.

This means that you would begin a transaction with ttsBegin and end it with ttsCommit (if successful) or throw an exception (if the transaction is unsuccessful). It is unclear from the documentation, but transactions mean manipulation of application tables.

You would use them when you want to ensure that your read or update operations on application tables are not made inconsistent by other table operations that happen simultaneously

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);
}

No comments:

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...