User Guide

cffunction 147
Usage
The cffunction tag can define a function that you call in the same manner as a ColdFusion built
in function.
To define a ColdFusion component (CFC) method, you must use a
cffunction tag. For
information on using the
cffunction tag.
The following example shows cffunction tag attributes for a simple CFC method that returns a
ColdFusion Query object.
<cffunction
name="getEmployees"
roles Optional "" (empty) A comma-delimited list of ColdFusion security roles that
can invoke the method. Only users who are logged in
with the specified roles can execute the function. If this
attribute is omitted, all users can invoke the method.
access Optional public The client security context from which the method can
be invoked:
private: available only to the component that declares
the method and any components that extend the
component in which it is defined
package: available only to the component that
declares the method, components that extend the
component, or any other components in the package
public: available to a locally executing page or
component method
remote: available to a locally or remotely executing
page or component method, or a remote client
through a URL, Flash, or a web service. To publish the
function as a web service, this option is required.
output Optional Function
body is
processed
as standard
CFML
Specifies under which conditions the function can
generate HTML output.
yes: The entire function body is processed as if it were
within a
cfoutput tag. Variables names surrounded by
number signs (#) are automatically replaced with their
values.
no: The function is processed as if it were within a
cfsilent tag
If you do not specify this attribute, the function body is
processed as standard CFML. Any variables must be
in
cfoutput tags.
displayname Optional Meaningful only for CFC method parameters. A value to
be displayed in parentheses following the function name
when using introspection to show information about the
CFC.
hint Optional Meaningful only for CFC method parameters. Text to be
displayed when using introspection to show information
about the CFC. The
hint attribute value follows the
syntax line in the function description.
Attribute Req/Opt Default Description