Identifying and checking for UDFs

You can use the IsCustomFunction function to determine whether a name represents a UDF. The IsCustomFunction function generates an error if its argument does not exist. As a result, you must ensure that the name exists before calling the function, for example, by calling the IsDefined function. The following code shows this use:

<cfscript>
if(IsDefined("MyFunc"))
   if(IsCustomFunction(MyFunc))
      WriteOutput("MyFunc is a user-defined function");
   else
      WriteOutput("Myfunc is defined but is NOT a user-defined function");
else
   WriteOutput("MyFunc is not defined");
</cfscript>

You do not surround the argument to IsCustomFunction in quotation marks, so you can use this function to determine if function arguments are themselves functions.


View comments in LiveDocs