Skip to main content
Inspiring
October 10, 2012
Question

How do I call a function from the other CFC

  • October 10, 2012
  • 2 replies
  • 643 views

Hi,

Is there the way to call the function from other cfc?

From cfc.message, how can i call the method "getuser" from user.cfc

<cfcomponent name="user">

    <cffunction name="getuser">

    </cffunction>

</cfcomponent>

<cfcomponent name="message">

    <cffunction name="get_message">

    </cffunction>

</cfcomponent>

Thanks

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
October 13, 2012

Strictly speaking, you don't call a function except you're inside the CFC containing the function. From elsewhere, you have to call the function on an object. Hence, first create an instance of the CFC, then call the function on that object.

Inspiring
October 10, 2012

Do it the same way you would call it from a .cfm file.