Search code examples
transactionsaxaptadynamics-ax-2012dynamics-ax-2012-r2

When using multiple AOS, how can I make sure a method has access to the most recent data?


Our environment consist of 5 AOS running AX2012 R2 CU6.

In the current scenario, users are populating many tables with new records. A WebService is set up on a specific AOS to retrieve the data.

It seems like the "new" data is never obtained by the WebService (unless the AOS is restrated), as these records were created on another AOS.

What would be the best way to ensure the WS has access to the latest data? I would love a server-side solution (tried implementing some appl.globalCache().clear() methods in the WS code without any success so far).

All tables in the data structure that is populated have their attribute "CacheLookup" set to "NotInTTS".

Also, when using the Tools -> Caches --> Refresh Elements menu item on the WS AOS, our webservice immediately returns the right data...


Solution

  • As your tables are cached using NotInTTS, you can put your data retrieval in a transaction:

    ttsbegin;
    select ...
    ttscommit;
    return ...
    

    If this does not work, you may consider it a kernel error, which should be reported.

    Flushing cashes may work, but will defeat their purpose.