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

Simple cfinvoke not working

Explorer ,
Oct 13, 2008 Oct 13, 2008
I have a page calling a pretty basic function of my CFC. Here's the code of the calling page:

<cfscript>
session.stCampaignData=structNew();
session.stCampaignData.campaignName="my name";
session.stCampaignData.campaignDesc="description";
</cfscript>

<cfinvoke component="#application.pathToMyCFC#" method="addCampaign" argumentcollection="#session.stCampaignData#">

Here's the function code:
<cffunction name="addCampaign" hint="Adds a Campaign to the system." access="public" returntype="void" output="false">
<cfargument name="stCampaignData" type="struct" required="true" />
...
</cffunction>

But no matter what, this function bombs. It's as if the argument never makes it:
The STCAMPAIGNDATA parameter to the addCampaign function is required but was not passed in.

If I set the output to true, in the function call, I can dump the session.stCampaignData structure.

Am I overlooking something??

TIA

511
Translate
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 ,
Oct 13, 2008 Oct 13, 2008
> <cfinvoke component="#application.pathToMyCFC#" method="addCampaign"
> argumentcollection="#session.stCampaignData#">

> <cfargument name="stCampaignData" type="struct" required="true" />

If stCampaignData is a single argument, then you want to pass it in by
name, eg:

<cfinvoke component="#application.pathToMyCFC#" method="addCampaign"
stCampaignData="#session.stCampaignData#">

ArgumentCollection is for passing in a bunch of arguments as a single
struct.

--
Adam
Translate
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
Valorous Hero ,
Oct 13, 2008 Oct 13, 2008
LATEST
> But no matter what, this function bombs. It's as if the
> argument never makes it:
> argumentcollection="#session.stCampaignData#

I think that syntax will pass in the structure contents as arguments. Not the structure object itself. So in other words, the function call looks something like this:

addCampaign( campaignName= "myName", campaignDesc="description");

As opposed to:

addCampaign( argumentcollection=session ); ... or ...
addCampaign( stCampaignData=session.stCampaignData);
Translate
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