IsCustomFunction |
Description
Determines whether a name represents a custom function.
Returns
True, if name can be called as a custom function; False, otherwise.
Category
Decision functions
Function syntax
    IsCustomFunction(name)
Parameters
Parameter | Description
name | Name of a custom function. Must not be in quotes. If not a defined variable or
| function name, ColdFusion generates an error.
Usage
The IsCustomFunction function returns true for any function that can be called as a custom function, including functions defined using CFScript function declarations and cffunction tags, and functions that are ColdFusion component methods. For CFC methods, you must first instantiate the component.
Note: | To prevent undefined variable exceptions, always precede IsCustomFunction with an IsDefined test, as shown in the example.
Example
    <h3>IsCustomFunction Example</h3>
    <cfscript>
    function realUDF() {
       return 1;
    }
    </cfscript>
    <cfset X = 1>

    <!--- Example that fails existence test --->
    <cfif IsDefined("Foo") AND IsCustomFunction(Foo)>
       Foo is a UDF.<br>
    </cfif>

    <!--- Example that passes existence test but fails IsCustomFunction --->
    <cfif IsDefined("X") AND IsCustomFunction(X)>
       X is a UDF.<br>
    </cfif>

    <!--- Example that passes both tests--->
    <cfif IsDefined("realUDF") AND IsCustomFunction(realUDF)>
       realUDF is a function.<br>
    </cfif>

    <!--- Example using a CFC, defined in TestCFC.cfc--->
    <cfobject component="TestCFC" name="myTestCFCobject">
    <CFIF IsDefined("myTestCFCobject.testFunc") AND
          IsCustomFunction(myTestCFCobject.testFunc)>
       myTestCFCobject.testFunc is a function.
    </CFIF>

name |
Name of a custom function. Must not be in quotes. If not a defined variable or function name, ColdFusion generates an error.