Skip to main content
Participant
February 24, 2011
Question

Application Variables not available to CFC

  • February 24, 2011
  • 1 reply
  • 542 views

I have an application that is working great. We use CFCs extensively. The CFC objects and application variables are set up in application.cfc (see below). The CFCs are in the cfc folder.  All the pages All is well.

<cfscript>

// CREATE APP VARIABLES

APPLICATION.AppInfo = structNew();

APPLICATION.AppInfo.mySchema = "dhop_123";

APPLICATION.AppInfo.mySchema = "dhop_123";

// CREATE OBJECT FOR CFC
ro = structNew();
ro.general = createObject('component', 'xxx.cfc.generalFunctions');

</cfscript>

The situation: I created a it of Ajax using jQuery. The page that I call is found and loads well via the script below. The parameters "Home" and "LetterToGet" are passed correctly to the page (getusers.cfm).

<script type="text/javascript">
$("document").ready( function () {

    $(".whichContent").click(function(e) {
        X = e.target.value;
        $("#Users").hide(100);
        $("#Users").load("ajax/getusers.cfm?Home=Users&LetterToGet="+X);
        $("#Users").show(500);
    $});

});
</script>

My page can actually access the CFCs in the CFC folders if they don't require any APPLICATION variables.  If they DO require APPLICATION variables, such as to run a query, they fail.

Is there a TYPICAL problem that occurs when a single page is called and tries to access the APPLICATION variables?

This topic has been closed for replies.

1 reply

pete_freitag
Participating Frequently
February 25, 2011

Application scoped variables should still be accessible from a CFC provided your

are still in the same application scope (you don't have another application.cfc/cfm taking precidence).