web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Is OCC and PCC still worked in D365FO

(1) ShareShare
ReportReport
Posted on by 1,056

Hi team,
Is still OCC &PCC worked in D365FO. Is there any specific setup required to use them. I have do research but not yet found appropriate answer.

Please advise, thanks

 

Categories:
  • Suggested answer
    Martin Dráb Profile Picture
    240,744 Most Valuable Professional on at

    For reference, the question is about optimistic and pessimistic concurrency control.

     

    The answer is yes, both options are available in F&O. PCC is AX from the very beginning and OCC was introduced in Dynamics AX 4.0.

     

    You can control the type of concurrency control on the table level (OccEnable property) or for individual queries (pessimisticLock keyword, concurrencyModel() method etc.).

  • CU10121822-0 Profile Picture
    1,056 on at

    Hi , what I understood…

    OCC-

    select forUpdate salesTable
       where salesTable.SalesId == 'SO-1001';

    salesTable.CustGroup = 'RETAIL';
    salesTable.update();

    If both user trying to update at same time. It can detect the concurrency conflict.

     

    PCC-

    ttsBegin;

    select pessimisticLock forUpdate inventSum
       where inventSum.ItemId == 'ITEM-A';

    if (inventSum.AvailPhysical >= 7)
    {
       inventSum.AvailPhysical -= 7;
       inventSum.update();
    }

    ttsCommit;

    Here The first transaction obtains a lock on the record.
    The second transaction has to wait until the first transaction completes.

     

    concurrencyModel()- It returns the table's configured concurrency model.

     

    Am I correct?

     

    Pls advise, thanks 

     

     

     

     

  • Suggested answer
    Martin Dráb Profile Picture
    240,744 Most Valuable Professional on at

    Your understanding is only partially correct.

     

    In your example with InventSum, you forgot to take OccEnabled property into account. It's No in this case, therefore queries to InventSum are pessimistically-locked by default and using pessimisticLock in a query has no effect. It would make sense for a table with OccEnabled=Yes.

     

    You're also wrong about concurrencyModel() method. If you look at the method signature or its documentation, you'll find that it accepts a parameter, therefore you can use it to change the concurrency model at runtime. You can use Find references on ConcurrencyModel EDT to find examples in the application. One of them is in AccountingDistribution::find():

     

    public static AccountingDistribution find(
       AccountingDistributionRecId _recId,
       boolean _forupdate = false,
       ConcurrencyModel _concurrencyModel = ConcurrencyModel::Auto)
    {
       AccountingDistribution accountingDistribution;
       ;

       accountingDistribution.selectForUpdate(_forupdate);
       if (_forupdate  && _concurrencyModel != ConcurrencyModel::Auto)
       {
           accountingDistribution.concurrencyModel(_concurrencyModel);
       }
        ...

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 426 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 358

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 353 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans