• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Contributor ,
Dec 21, 2012 Dec 21, 2012

Copy link to clipboard

Copied

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>

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

Views

988

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 22, 2012 Dec 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"

   

...

Votes

Translate

Translate
Community Expert ,
Dec 22, 2012 Dec 22, 2012

Copy link to clipboard

Copied

<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#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 26, 2012 Dec 26, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 26, 2012 Dec 26, 2012

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 26, 2012 Dec 26, 2012

Copy link to clipboard

Copied

LATEST

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


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 22, 2012 Dec 22, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation