How to Pass Variables to a CFC
- 1). Open the ColdFusion application from the Windows "Start" menu and open the Web project in the ColdFusion workspace.
- 2). Double-click the file you want to use to call the ColdFusion method, then add the call to the function. The following code sets up a call to the function without adding any parameters:
<cfinvoke method="getCustomerName"> - 3). Pass the parameters to the method. For instance, the method set up in Step 2 is "getCustomerName." You pass the customer's ID to get the customer's information from the method. The following code completes the call to the function by passing the ID to the method:
<cfinvoke method="getCustomerName" ID="1111"> - 4). Add additional parameters to the method call. To send several parameters to the method, separate each parameter using a space character. The following code passes the customer ID and the first name:
<cfinvoke method="getCustomerName" ID="1111" first_name="Joe">
Source...