Learning Kentico: Scheduled Tasks

I was supposed to blog this last Friday but I ran out of time. Spent trying to resolve the issues I encounted and was only able to fix it just at the nick of time (before the office closes at 6pm). Whew!

There were quite a few errors I encountered when working with the exercise including the practice example and below are some them:

a. When trying to follow his example about importing products, I couldn't seem to resolve the ERPProductHelper does not exist in the current context issue. I used all the namespace he used but still the same. I couldn't find ERPProductHelper in the Kentico Documentation and tried other solutions but still no luck :(

ERP Product Helper does not exist in the current context
So I just skipped this and didn't include in the project. But if you know how to solve this, feel free to comment below. 

b. The No Definition found for Set Doctors issue. Remember I skipped the 2nd exercise of Kentico API because I got confused with it? In here, I have really no choice but to do it. 

No Set Doctor Method
And I learned that I don't need to modify the previous code generated in the DoctorInfoProvider class which I did in Custom Module exercise and that I only need to add a new public method Set Doctors. And it resolved the no definition issue. :)

c. The next one was File does not exist issue (when I ran the Import Doctor scheduled task)

File does not exist

I couldn't really understand why the file is not found. I've placed it in the App Data folder, created my own folder and placed the Doctor List.csv.

I rechecked all my steps for creating scheduled tasks:

1. Create a new class implementing the CMS.Scheduler.ITask interface - done
2. Add the RegisterCustomClass assembly attribute above the class declaration. - done

 [assembly: RegisterCustomClass("ImportDoctor", typeof(ImportDoctor))]
Import Doctor not found

At first I didn't wrap it in namespace and then tried wrapping it to see if it's fixed the issue because when I reset the executions I got this error above) 

3. Implementation of scheduled task - register it in the Scheduled tasks app and configure the settings (execution interval etc) - done

register scheduled task


I have also asked myself it it has something to do with the Task provider name because mine is only showing custom classes but in his example video, it is showing the name he specified. But nahhh..it's not. 

And you know the culprit? It's because I didn't specify the task data property. Noticed in the above screenshot, the task data field is emptyJaaahhh...he didn't show this on the video. Huhu. Perhaps that part, he didn't just capture it. But at least, I know now. :) Hehe. 

Task Data location

Now import successful! 

scheduled task, import


Till next time! And for reference about Scheduled Task properties. check-out this link

No comments:

Post a Comment

Post Top Ad