Creates a tag-based user-defined function (UDF) or a component method for a ColdFusion Component (CFC). The terms “function” and “method” are used interchangeably.

Besides the named attributes listed in the “Attributes” section, you can pass any additional desired attributes to the cffunction tag as user-defined attributes. Although these attributes don’t do anything, they are available as metadata when the component containing the method is introspected using the GetMetaData( ) function. You may use any attribute names you wish with the exception of those reserved by cffunction: name, displayname, hint, returntype, roles, access, output, and arguments.


name=" Name "

Name for the function. Function names follow the same naming rules as ColdFusion variables. They must begin with a letter, underscore, or Unicode currency symbol ($) and can contain only letters, numbers, underscores, and Unicode currency symbols. Compound variable names such as My.Function are not allowed. Function names also may not begin with cf, cf_, coldfusion, or coldfusion_. Additionally, you may not give a function the same name as a built-in ColdFusion function. Required.


Used only when function is used as a component method. Specifies the context within which the component method can be accessed. Options are:


Method only available to the component ...

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.