Hello is there a way to check if a function exists in coldfusion. It is throwing an error function is not defined
I believe isDefined('functionname')
works. So you can do:
<cfif isDefined('functionname')>
<cfset functionname() />
</cfif>
If it's a potential method of an object named obj
for example you can also do:
<cfif structKeyExists(obj,'functionname')>
<cfset obj.functionname() />
</cfif>
Or
<cfif isDefined('obj.functionname')>
<cfset obj.functionname() />
</cfif>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With