Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Use of "CreatedTransactionId" and "OCCEnabled" property in Table

(0) ShareShare
ReportReport
Posted on by 2

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Use of "CreatedTransactionId" and "OCCEnabled" property in Table

    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).

  • @rp@n Profile Picture
    @rp@n 2 on at
    RE: Use of "CreatedTransactionId" and "OCCEnabled" property in Table

    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 

  • @rp@n Profile Picture
    @rp@n 2 on at
    RE: Use of "CreatedTransactionId" and "OCCEnabled" property in Table

    Thanks Sukrut

  • Florian Hopfner Profile Picture
    Florian Hopfner 2,451 on at
    RE: Use of "CreatedTransactionId" and "OCCEnabled" property in Table

    Try taking a look at Optimistic Concurrency Control [AX 2012].

  • @rp@n Profile Picture
    @rp@n 2 on at
    RE: Use of "CreatedTransactionId" and "OCCEnabled" property in Table

    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

  • Verified answer
    Brandon Wiese Profile Picture
    Brandon Wiese 17,788 on at
    RE: Use of "CreatedTransactionId" and "OCCEnabled" property in Table

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans