Skip to main content
Inspiring
December 21, 2012
Answered

How to use "SESSION_kt_email" in my CFC..?

  • December 21, 2012
  • 2 replies
  • 1329 views

Can someone show me the correct way to reference a Session variable called "SESSION.kt_email" and filter it out of my User_email list?

- The CFC below is used to grab all of the correct emails, but "exclude" the email of the logged in user

- I'm using the GROUP_CONCAT so the outputted emails are separated by commas

- My CFC works fine until I add in the Session stuff, then I get this error..

Here is the CFC email_actions_updated.cfc:

-----------------------------------------------

<!--- Generated by Adobe Dreamweaver CS4 10.0.0.4117 [en] (Win32) - Thu Dec 20 2012 16:57:12 GMT-0600 (Central Standard Time) --->

<cfcomponent>

          <cffunction name="GetEmails" access="remote" returnType="any" output="false">

                    <cfargument name="id" type="numeric" required="true">

  <cfargument name="kt_email" type="any" required="true">

       

                    <!--- GetEmails body --->

        <!--- Create Filtered Email list --->

<cfquery name="rsEmailAction" datasource="care">

SELECT GROUP_CONCAT(NULLIF(User_email, <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.kt_email#"> )) AS User_email

  FROM (

SELECT    CONCAT(tblemailaction.uea_User, "@corp.clearwave.com") AS User_email,

tblemailaction.uea_ADSL

FROM      tblemailaction, tbltickets, tbltickettype

WHERE     tbltickets.ttType = tbltickettype.ttDesc

  AND     tbltickettype.ttID = tblemailaction.uea_ADSL

  AND     tblemailaction.uea_Updated = 1

  AND ttNum = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.id#">

) q

</cfquery>

                    <cfreturn rsEmailAction>

          </cffunction>

</cfcomponent>

-----------------------------------------------

Here is my sample calling page:

------------------------------------------------

<cfparam name="URL.id" default="40865">

 

<!--- Create Filtered Email list and just send Email to flagged Users --->

<cfinvoke

component="CRM.CTS.email_actions_updated"

method="GetEmails"

returnvariable="rsEmailAction"

id="#URL.id#">

   

<head>

</head>

<body>

<input name="email_list" type="text" id="email_list" value="<cfoutput>#rsEmailAction.User_email#</cfoutput>" size="150" />

</body>

---------------------------------------------

    This topic has been closed for replies.
    Correct answer BKBK

    <cffunction name="GetEmails" access="remote" returnType="any" output="false">

        <cfargument name="id" type="numeric" required="true">

        <cfargument name="kt_email" type="any" required="true">

    ...

    ...

    <cfinvoke

        component="CRM.CTS.email_actions_updated"

        method="GetEmails"

        returnvariable="rsEmailAction"

        id="#URL.id#">

    Your function requires 2 arguments. Yet your cfinvoke has just one. Were you perhaps going for something like this:

    <cfinvoke

        component="CRM.CTS.email_actions_updated"

        method="GetEmails"

        returnvariable="rsEmailAction"

        id="#URL.id#"

        kt_email="#session.kt_email#">

    2 replies

    Inspiring
    December 22, 2012

    In addition to BKBK's answer, are you sure about the double quotes in the concat function of your query?

    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    December 22, 2012

    <cffunction name="GetEmails" access="remote" returnType="any" output="false">

        <cfargument name="id" type="numeric" required="true">

        <cfargument name="kt_email" type="any" required="true">

    ...

    ...

    <cfinvoke

        component="CRM.CTS.email_actions_updated"

        method="GetEmails"

        returnvariable="rsEmailAction"

        id="#URL.id#">

    Your function requires 2 arguments. Yet your cfinvoke has just one. Were you perhaps going for something like this:

    <cfinvoke

        component="CRM.CTS.email_actions_updated"

        method="GetEmails"

        returnvariable="rsEmailAction"

        id="#URL.id#"

        kt_email="#session.kt_email#">

    jligAuthor
    Inspiring
    December 26, 2012

    I added in the second argument as follows:

    ------------------------------------------------

    <!--- Create Filtered Email list and just send Email to flagged Users --->

    <cfinvoke

    component="CRM.CTS.email_actions_updated"

    method="GetEmails"

    returnvariable="rsEmailAction"

    id="#URL.id#"

    kt_email="#session.kt_email#">

    And now I'm getting an error on the cfc:

    ---------------------------------------------

    Element SESSION.KT_EMAIL is undefined in ARGUMENTS.

    Inspiring
    December 26, 2012

    Is the cfc code still the same as in the opening post?  In any event, if you comment out all the code in your function and replace it with <cfdump var="#arguments#">, do you see the two arguments and their expected values?