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

cfScedule Flex 3 application

Guest
Dec 30, 2007 Dec 30, 2007

Copy link to clipboard

Copied

I am currently building a flex 3 application that will create, update and delete tasks in the cfadministrator from a flex application. We are using a shared hosting that has everything enabled except for rds and cfexecute.
I have create 2 mysql db tables that will hold the schedule information and logging the tasks and errors of executing.

My problem is how do i execute the a cfc that has cfschedule with my arguments that comes form the flex application. I know that if I place cfschedule in a cfm page and open it will interact with the task schedule in the administrator, but I don't really know how to execute cfschedule in a cfc.

I am using ColdFusion 8 with MYSQL 5.0 and Flex 3

TOPICS
Advanced techniques

Views

361

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 30, 2007 Dec 30, 2007

Copy link to clipboard

Copied

To beat Dan to what he's probably going to ask (and rightly so):

What happens when you try it?

Don't ask us what will happen. Try something, and if it doesn't work,
*and* you can't work out why, *then* get back to us...

What makes you think that your sample code won't work?

What version of CF are you using, btw? If it's CF8 you can simply validate
your passed-in arguments, then pass the whole lot into the <cfschedule>
call with the attributecollection attribute.

--
Adam

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
Guest
Dec 30, 2007 Dec 30, 2007

Copy link to clipboard

Copied

yes Adam I am using CF8. I have tried this, but I have other errors, that I seem that I cannot pin point.

In My Flex app I call this function:

private function saveTask():void {






var obj:ScheduleTask = new ScheduleTask;

/* Sets id if record is to be updated */
if(_taskList.selectedIndex != -1){
obj.scheduletaskid = _taskList.selectedItem.scheduletaskid;
}
if(taskAction == "pause") {
obj.activetask = String("Non Active");
}
else {
obj.activetask = String("Active");
}


obj.task = String(_task.text);
obj.taskaction = String(taskAction);
obj.description = String(_description.text);
obj.startdate = _startDate.selectedDate as Date;
obj.starttime = String(_startTime.text + _startDayLight.text);
obj.enddate = _endDate.selectedDate as Date;
obj.endtime = String(_endTime.text + _endDayLight.text);
obj.operationtask = String(_operationTask.selectedField);
obj.portnumber = Number(_portNumber.text);
obj.proxypassword = String(_proxyPassword.text);
obj.proxyport = Number(_proxyPort.text) ;
obj.proxyserver = String(_proxyServer.text);
obj.proxyuser = String(_proxyUser.text);
obj.publish = String(publishGroup.selectedValue);
obj.publishfile = String(_publishFile.text);
obj.publishpath = String(_publishPath.text);
obj.requesttimeout = Number(_requestTimeOut.text);
obj.resolveurl = String(resolveURLGroup.selectedValue);


if(intervalGroup.selectedValue == "time"){
obj.taskinterval = String(_taskIntervalSeconds.text);
}
else {
obj.taskinterval = String(_taskIntervalDates.text);
}


obj.urlpassword = String(_urlPassword.text);
obj.urlpath = String(_urlPath.text);
obj.urlusername = String(_urlUserName.text);




/* if(_taskList.selectedIndex != -1 && _taskList.selectedItem.createdby != null){
obj.createdby = String(_taskList.selectedItem.createdby);
obj.updatedby = String(userSession.getItemAt(0).username);
}
else {
obj.createdby = String(userSession.getItemAt(0).username);
obj.updatedby = String("");
} */
roSchedule.setSchedule(obj);
roTaskSchedules.save(obj);

}

Now the ro.Schedule.setSchedule(obj); tag send the array to the cfc using RemoteObject tag.

Then I get this error:
[RPC Fault faultString="Unable to invoke CFC - The TASKACTION parameter to the setSchedule function is required but was not passed in." faultCode="Server.Processing" faultDetail=""]
at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\dev\depot\flex\branches\flex_201_borne...
at mx.rpc::Responder/fault()
at mx.rpc::AsyncRequest/fault()
at NetConnectionMessageResponder/statusHandler()
at mx.messaging::MessageResponder/status()

It seems this error has to do with the TASKACTION attributes that I have in place, but I have looked this over and it is a String Value and is Data Typed as String.

I guess the reason why I thought this wouldn't really work is that you have to execute the cfschedule in a page, by opening the page like I have done some many time. I just really don't see the connection of this code really executing. I am still pretty new at CFC's.

Can you explain more about what you said on the "attributecollection attribute"?

By the way thanks for the response, I have been banging my head on this subject for a few days now. plus the fact that I have the flu. Thanks alot.

Link

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 30, 2007 Dec 30, 2007

Copy link to clipboard

Copied

> By the way thanks for the response, I have been banging my head on this
> subject for a few days now. plus the fact that I have the flu. Thanks alot.

No prob. It's 1:30am here now and I'm chucking it in for the day. I'll
have a look @ this tomorrow, if that's OK (well even if it's not: that's
what's going to happen ;-)

In the mean time, read the docs regarding the attributecollection thing:
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_r-s_11.html.

You can save yourself some typing just by going:

<cfschedule attributecollection="#arguments#">

Handy if you don't know which attributes you're passing to the tag.

Like I said, though: validate the args before doing that.

This is nowt to do with your problem, it'll just simplify your code a bit.

--
Adam

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
Guest
Dec 30, 2007 Dec 30, 2007

Copy link to clipboard

Copied

Okay Adam I added dummy data to set up a cfschedule in the cfc and then called it and it worked!... I think my problem is how the data is being sent to the cfc. in the arguments. I did debug the flex app and seen the (obj) being sent out and all the data is there. its just not coming in the cfc the same way I guess. Thanks for the help. Link

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 31, 2007 Dec 31, 2007

Copy link to clipboard

Copied

> Okay Adam I added dummy data to set up a cfschedule in the cfc and then called
> it and it worked!... I think my problem is how the data is being sent to the
> cfc. in the arguments. I did debug the flex app and seen the (obj) being sent
> out and all the data is there. its just not coming in the cfc the same way I
> guess. Thanks for the help. Link

Change your method to just dump the arguments it receives from Flex to a
file, and eyeball what CF is receiving. Use <cfsavecontent> to capture
your <cfdump> as a string.

That might cast some light on matters.

--
Adam

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
Engaged ,
Dec 31, 2007 Dec 31, 2007

Copy link to clipboard

Copied

LATEST
Another tip for doing any flash / flex to coldfusion integration is to run CF from the command line. Then you can see errors generated by CF in the console window which will save you many an hour of head scratching!

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