Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6673205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:36:00+00:00 2026-05-26T03:36:00+00:00

A lot of sources call a single resource, typically through <cfthread ..> , but

  • 0

A lot of sources call a single resource, typically through <cfthread ..>, but some use <cfinclude ..>.

Ideally, the code looks for the variable previous_state. If some variants are passed, then the resource will attempt to use them.

I received this error:

Variable PREVIOUS_STATE is undefined.

The line record points to the <cfif ..> in this chunk of code.

<cfparam    name=       "previous_state"
            default=    "" />

<cfif   isSimpleValue( previous_state )
        and len( previous_state ) eq 0>
    <cfset  previous_state= previousState />

</cfif>

My question is how can previous_state be undefined?

I can duplicate it in the application, but it’s a fairly complex chain of code using threads. Perhaps the reference was eaten by the garbage collector?

I’m having trouble duplicating it in a simple code segment. I’ve tried setting the variable to the return of a function with returnType= "void", but <cfparam ..> seems to reset it to an empty string.

Here’s the full code context. I removed the unrelated vars and such.

// Page
oComponent.foo();

// Component.foo()
<cfset  var local=  {
    previous_state= QueryNew( "foo" , "varchar" )

} />

<cfthread   name=   "foo_#createUUID()#"
            previousState=  "#local.previous_state#">
    <!---   Module does unrelated things... --->
    <cfmodule   template=   "some_module.cfm">
        <cfoutput>
        // unrelated things

        <cfparam    name=       "previous_state"
                    default=    "" />

        <!--- Next line is throwing error. --->
        <cfif   isSimpleValue( previous_state )
                and len( previous_state ) eq 0>
            <cfset  previous_state= previousState />

        </cfif>

        </cfoutput>

    </cfmodule>

</cfthread>

I’m now thinking cfparam is trying to use a scope that no longer exists by the time this code executes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:36:01+00:00Added an answer on May 26, 2026 at 3:36 am

    As the code is within a CFTHREAD tag I thing you should be passing previous_state as a CFTHREAD attribute, such as:

    <cfparam name="previous_state" default="" />
    
        <CFTHREAD previous_state = previous_state
        previousState=  "#local.previous_state#">
    
        <cfif  isSimpleValue( ATTRIBUTES.previous_state  ) ........
    
        </CFTHREAD>
    

    To quote the CF Docs:

    “The Attributes scope contains attributes that are passed to the scope, and is available only within the thread and only for the life of the thread.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call a method with argument color. But there are a lot
I want to call some R code from within Java, on a Linux machine
There are a lot of free sources to learn about the object model of
Our software manages a lot of data feeds from various sources: real time replicated
I've scored the internet for sources and have found a lot of useful information,
Pimpl's are a source of boilerplate in a lot of C++ code. They seem
I googled a lot, and could not find a single open source implementation of
I believe lot of people already asked this question before, but i kept getting
I call obackgroundworker.CancelAsync(); on a background worker currently doing some work in another thread
For some time now I have been googling a lot to get to know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.