Search code examples
coldfusioncfml

CFLDAP name attribute...can't use struct?


This is in CF11/2016. When I try to use a struct variable (i.e., local.o) for the "name" attribute in a CFLDAP query, it throws an error:

Attribute validation error for tag CFLDAP.

The value of the attribute name, which is currently local.o, is invalid.  

local["o"] doesn't work, either. What am I doing wrong?


Solution

  • You can achieve this another way.

    <cffunction>
    <cfset var ManagerSelect = ''>  <!--- keeps the variable local to the function --->
    <cfldap action = "query" name = "ManagerSelect">
    <cfset local.OtherVariable = "something else">
    etc
    </cffunction>
    

    Note that the line <cfset local = StructNew()> is unnecessary inside a function.