5 Replies Latest reply on Dec 26, 2012 11:50 AM by jlig

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

    jlig Level 1

      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..

      cfc_error.jpg

       

      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>

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

        • 1. Re: How to use "SESSION_kt_email" in my CFC..?
          BKBK Adobe Community Professional & MVP

          <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. Re: How to use "SESSION_kt_email" in my CFC..?
            Dan Bracuk Level 5

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

            • 3. Re: How to use "SESSION_kt_email" in my CFC..?
              jlig Level 1

              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.

              • 4. Re: How to use "SESSION_kt_email" in my CFC..?
                Dan Bracuk Level 5

                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?

                1 person found this helpful
                • 5. Re: How to use "SESSION_kt_email" in my CFC..?
                  jlig Level 1

                  Dan, that helped to point to the problem and the error on my cfc.. I had indeed changed the cfc since my first post and inserted the word "Session" to my Argument as below..

                   

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

                   

                  I changed the #ARGUMENTS.Session.kt_email# to just #ARGUMENTS.kt_email# and it now returns the correct results!

                   

                  Thanks to both you and BKBK

                   

                  ps: you must live in these forums..?