tracker issue : CF-4204837

select a category, or use search below
(searches all categories and all time range)
Title:

Error in documentation on using cfscheduler leads to users getting errors

| View in Tracker

Status/Resolution/Reason: To Test//Fixed

Reporter/Name(from Bugbase): A. B. / ()

Created: 07/11/2019

Components: Documentation, adobe.com

Versions: 2018

Failure Type:

Found In Build/Fixed In Build: 2018.0.03 /

Priority/Frequency: Normal /

Locale/System: / Win 2016

Vote Count: 0

Problem Description: 
The  adobe.com documentation on the Scheduler at 

https://helpx.adobe.com/coldfusion/developing-applications/developing-cfml-applications/using-the-coldfusion-debugger/using-scheduler.html

contains an error. The error is in the code sample of the listener CFC. This is becoming a problem of some urgency, because users have been copying the errorneous code, having faith in it because it is from "official" Adobe documentation. For example, two user-experiences:

https://forums.adobe.com/thread/2636967
https://forums.adobe.com/thread/1707026

Steps to Reproduce:
1) set up in a CFM page a simple scheduled task and configure it to use an event-handler. For example

<cfschedule task="testTask" 
action="update" 
startDate = "11/07/2019"
startTime = "12:01"
endDate = "11/07/2019"
endTime = "23:00"
interval = "120"
overwrite = "yes"
eventhandler="dotted.path.to.TaskListener"
/>

2. For the listener CFC code, use the example from 

https://helpx.adobe.com/coldfusion/developing-applications/developing-cfml-applications/using-the-coldfusion-debugger/using-scheduler.html

Actual Result:
You will get errors such as

Jul 11, 2019 12:01:14 PM Error [http-nio-8500-exec-2] - Invalid eventhandler.Error: Eventhandler workspace.myProject.task.TaskListener could not be found. The specific sequence of files included or processed is: C:\ColdFusion2018\cfusion\wwwroot\workspace\myProject\task\task.cfm, line: 9

Jul 11, 2019 12:03:10 PM Error [http-nio-8500-exec-5] - Function argument mismatch.The execute function does not specify the same arguments or arguments in the same order in  the C:\ColdFusion2018\cfusion\wwwroot\workspace\myProject\task\TaskListener.cfc ColdFusion component and the CFIDE.scheduler.ITaskEventHandler ColdFusion interface. The specific sequence of files included or processed is: C:\ColdFusion2018\cfusion\wwwroot\workspace\myProject\task\task.cfm, line: 11

Expected Result:
No errors

The solution:
1) begin the code with <cfcomponent>

2) add the following argument to the 'execute' event
<cfargument name="context" type="struct" required="false" />

Attachments:

Comments:

Fix is incomplete. Please begin the code sample with: <cfcomponent implements="CFIDE.scheduler.ITaskEventHandler">
Comment by A. B.
31015 | July 11, 2019 08:37:20 PM GMT