Dear All,
Can you please let me know what is the Use of "CreatedTransactionId" and "OCCEnabled" property is set to YES in Table?
How this property will work ?
Please give me more shed on this.
Thanks!
Arpan
*This post is locked for comments
Dear All,
Can you please let me know what is the Use of "CreatedTransactionId" and "OCCEnabled" property is set to YES in Table?
How this property will work ?
Please give me more shed on this.
Thanks!
Arpan
*This post is locked for comments
A couple points to add.
For OCC, AX does not lock a record as soon as it is grabbed from the database and put into your buffer for updating. Instead, AX waits until the update itself is performed ... which could theoretically be hundreds of lines of code later, for example. At that point, AX compares the value of the RecVersion field in your buffer with the value of RecVersion for the same record in the database. If they match, then AX knows that nobody has updated the record since it was grabbed and put into your buffer and so AX does perform the update: in the process, AX also changes the value of RecVersion in the database to a new random integer. On the other hand, if the update is trying to be performed and the RecVersion values in your buffer and the database do not match, then AX knows that another user has updated that record since the time that it was put into your buffer; AX will not perform the update, and will throw an update conflict error.
As for CreatedTransactionId, that is a read-only field maintained by AX. For a table that has its CreatedTransactionId property set to Yes, when an insert occurs, AX automatically sets the CreatedTransactionId value (to the current value of appl.curTransactionId()). The CreatedTransactionId is tied to the outermost transaction only – that is, if there are nested transactions, they do not get their own CreatedTransactionId, but instead share the same one as the master (outermost) transaction. Only after the ttsLevel has dropped back to 0 will a new CreatedTransactionId get generated.
Other than preprocessed SSRS reports, CreatedTransactionId is also used in posting to the general ledger. The GeneralJournalEntry table (as well as the GeneralJournalAccountEntry table) has a CreatedTransactionId field, and if a dozen GeneralJournalEntry records are inserted within a single master (outermost) transaction, they are all linked by the shared CreatedTransactionId value. More information about that master transaction can be found in the TransactionLog table (in AX, the user sees that by clicking Audit Trail on the Voucher Transactions form).
The values used for CreatedTransactionId are maintained in the SystemSequences table (the record where ID = -2).
Hi Sukrut,
I am giving example of OCC and PCC.
ttsbegin;
while select forupdate inventTrans // Here PCC locked InventTrans till updation
{
inventTrans.itemId = "A0001";
inventTrans.update() // here OCC locked record . Means during actual update.
}
ttscommit;
Please let me know the above example is correct?
Please give me more shed on this.
Thanks!
Arpan
Thanks Sukrut
Try taking a look at Optimistic Concurrency Control [AX 2012].
Thanks Brandon,
I well understand about property createTransactionId.
One thing if OCC enabled is set to YES in table means it's controlled "Record Versioning" and
if set to NO means enable "Pessimistic concurrency" which controlled "Record locking". Which used during updation.
Is't correct ?
Please give me more shed on this.
Thanks!
Arpan
OCC is enabled by default across virtually all tables in AX 2012, so setting OCCEnabled to Yes will not change anything. Setting it to No will enable pessimistic concurrency which will use record locking instead of record versioning.
CreatedTransactionId is not used for much. One place I know it is used is with pre-processed SSRS reports where large reports have their data generated in advance, and then smaller reports are spooled from that large data set (where CreatedTransactionId is used to identify records spooled off for printing). Customer aging is a good example of this.
André Arnaud de Cal...
292,494
Super User 2025 Season 1
Martin Dráb
231,305
Most Valuable Professional
nmaenpaa
101,156