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 :
Microsoft Dynamics AX (Archived)

Clear cache with code (X++)

(0) ShareShare
ReportReport
Posted on by 6,648

Hi ALL,

How we can clear cache such as (record cache, global object cache, browser cache, various caches in SQL Server and many more,...) with Code?

Could you please give me sample code?

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    238,928 Most Valuable Professional on at

    Hi Hossein, only some caches are reachable from X++. For instance, you can remove entries from the global cache of your session, but you can't clear browser cache on the client machine.

    By the way, I fixed your spelling of cache (from "cash"); using the right spelling will help you when searching for existing information on internet.

  • Hossein.K Profile Picture
    6,648 on at

    Hi Martin,

    you can give a sample code for clear cashe which is access in x ++?

    I want to clear cashes which is access manualy(AOT/Tools/Cashes/...)

    Thanks.

  • Suggested answer
    Martin Dráb Profile Picture
    238,928 Most Valuable Professional on at

    A few examples:

    • SysFlush* classes
    • SysGlobalObjectCache::clearAllCaches()

    By the way, it's really "cache", not "cash".

  • Verified answer
    Galyna Fedorova Profile Picture
    3,566 on at

    Try to check this link gfeaxblog.wordpress.com/.../ax-2012-clear-the-cache

  • Hossein.K Profile Picture
    6,648 on at

    Hi Galyna,

    When I run your code(job),I face with this error:

    0312.Untitled.png

  • Martin Dráb Profile Picture
    238,928 Most Valuable Professional on at

    Please show the full error message, including the stack trace.

  • Galyna Fedorova Profile Picture
    3,566 on at

    Please change the quotes in the info. Instead of “, please use "

  • Jie G Profile Picture
    Microsoft Employee on at

    Hi Hossein,

    The job in https://gfeaxblog.wordpress.com/2017/12/14/ax-2012-clear-the-cache/ works fine in my test machine. Did you build it successfully? 

  • Hossein.K Profile Picture
    6,648 on at

    Hi Galyna

    your answer is correct.

    Thanks

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Pratik Bhosle Profile Picture

Pratik Bhosle 2

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans