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)

Problem Using SysGlobalCache object

(0) ShareShare
ReportReport
Posted on by 330

Hi,

I am trying to store SrsPrintDestinationSettings object as value in SysGlobalCache object.

I am setting this in a custom class.

This class is invoked twice so first time I am setting this object and second time I want to retrieve the object's value.

But second time, when it is trying to retrieve the settings, it is not going inside if statement as isSet() method is returning false.

I checked that by debugging. it is being set the first time but don't know why it is returning false.

Please suggest what went wrong.

I used the below code:

SRSPrintDestinationSettings settings;

SysGlobalCache prodStartPrinterSettings = infolog.globalCache();

if (controller.parmArgs().menuItemName() == menuitemOutputStr(ProdPicklistShowDialog))

{

settings = controller.getReportContract().parmPrintSettings();

prodStartPrinterSettings.set("abc", 1, settings);

}

if (prodStartPrinterSettings.isSet("abc", 1))

{

settings = (prodStartPrinterSettings.get("abc", 1));

}

*This post is locked for comments

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

    I assume that the problem is not in this piece of code, but rather in how you use it. Please simplify your solution by removing everything unrelated to this problem and then show us the whole code demonstrating your problem.

  • Yunus Shaik Profile Picture
    330 on at

    Hi Martin,

    The problem is with if (prodStartPrinterSettings.isSet("abc", 1)) statement.

    Even though I am setting this sysglobalcache object before this statement is invoked, the isSet method is returning false.

    I have even tried using prodStartPrinterSettings = appl.globalCache();

    but the issue remains same.

  • Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at

    Can you please share the code where you're "setting this sysglobalcache object before this statement is invoked" and "he isSet method is returning false"?

  • Yunus Shaik Profile Picture
    330 on at

    pls check this code:

    SRSPrintDestinationSettings settings;

    SysGlobalCache prodStartPrinterSettings = infolog.globalCache();

    if (controller.parmArgs().menuItemName() == menuitemOutputStr(ProdPicklistShowDialog))

    {

    settings = controller.getReportContract().parmPrintSettings();

    prodStartPrinterSettings.set("abc", 1, settings);    //Setting sysglobalcache object

    }

    if (prodStartPrinterSettings.isSet("abc", 1))         //isSet returning false second time this                                                                         class is invoked

    {

    settings = (prodStartPrinterSettings.get("abc", 1));   //getting sysglobalcache object

    }

  • Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at

    This snippet doesn't prove anything. For example, set() doesn't have to be ever called.

  • Yunus Shaik Profile Picture
    330 on at

    But if I don't call set(), then how will the printer settings get stored in sysglobalcache object?

  • Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at

    It won't - that's my point.

  • dolee Profile Picture
    11,279 on at

    Hi Yunus,

    Do you know that SGC is not a true global cache? (See the "Thin-client considerations" section in this link:

    www.axaptapedia.com/SysGlobalCache_class)

    Could the behavior related to that you are actually accessing a different cache the first & second time?

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 34

#1
CP04-islander Profile Picture

CP04-islander 34

#3
Jagadabi Profile Picture

Jagadabi 6

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans