Console FAQ
How to create scheduled tasks in C1?
I need a certain activity to run on a regular basis in C1. Can I have C1 do some tasks on schedule?
Answer:
Yes, you can. You should create a custom workflow that will auto-start with C1 and do a scheduled task:
- Create a workflow application in Visual Studio.
- Add your code to the workflow that will do the task on schedule.
- Have the workflow run on the C1 startup .
- Build the application and deploy it by copying it to the
~/Bin
folder on your website. - Restart the server.
For illustration, please examine the code sample (ZIP) that performs a simple task:
Download C1Sample.ScheduledTask.zip
Note: You should add the reference to the ~/Bin/Composite.dll
to build the application.
In this simplified sample, the workflow starts when the C1 starts up, waits for a few minutes, does the task and terminates. It writes a few information messages to the logger.
Note: To view the log messages, switch on the log viewer in the ~/App_Data/Composite/Composite.config
.