Passing parameters in direct method invocations

ColdFusion provides three methods for passing parameters to CFC methods in direct method invocations:

  1. You can pass the parameters the form of comma-separated name="value" entries, as in the following CFScript example:

    authorized = securityCFC.getAuth(name="Almonzo", Password="LauRa123");
  2. You can pass the parameters in an argumentCollection structure. The following code is equivalent to the previous example:

    argsColl = structNew(); 
    argsColl.username = "Almonzo"; 
    argsColl.password = "LauRa123"; 
    authorized = securityCFC.getAuth(argumentCollection = argsColl);
  3. You can pass positional parameters to a method by separating them with commas. The following example calls the getAuth method, and passes the name and password as positional parameters:

    authorized = securityCFC.getAuth("Almonzo", "LauRa123");
Note: For more information on using positional parameters and component methods in ColdFusion functions, see Creating user-defined functions.