Order of Precedence in Coldfusion Scopes

Order of Precedence in Coldfusion Scopes

If you do not specify the scope of variables when coding, according to the docs, CF will search for it in the following order (this is called the order of precedence):

  • Arguments
  • Variables
  • cfquery
  • CGI
  • File
  • URL
  • Form
  • Cookie
  • Client

Other scopes always need to be scoped:

  • Server
  • Application
  • Session
  • Request
  • Attributes
  • Error

Take the following as an example

All the above variables are valid and unique in their own scope but if you were to reference the firstname variable the result would be 'Fry'

comments powered by Disqus