### Scheduling a customized task using User Task

1. Create a task class that implements the UserTask interface and add the path of the class file to the class path. You can find the interface in the jet.server.api package available in `<install_root>\help\server\en\api`. JReport provides a demo class APIDemoDynamicExportTask.java in `<install_root>\help\server\en\samples` for your reference.
2. Create a task properties file defining the formats of exporting the task. For example, the content of the properties file is:

       jrs.rst=result_rtf
       jrs.pdf=true
       jrs.text=true
       jrs.excel=true
       jrs.ps=true
       jrs.html=result_html

3. Submit the task either from a server web page or by calling server API methods. The task can then be run by the server.
   - To submit the customized task from a server web page:
     1. On the JReport Console > Reports page, select the row that the report set is in.
     2. Click Run > Schedule on the task bar of the Reports page (or right-click in the row and select Schedule from the shortcut menu). The Schedule dialog is then displayed.
     3. Specify the settings in the General, Publish, Conditions, and Duration tabs as required. Here the Publish tab settings should be switched to those of User Task by clicking the link on the right bottom of the tab. Then, the name of the task class file you have defined that implements the UserTask interface and the task properties that define the export formats must be provided. You can either input the task properties manually or import them from the task properties file that you have created.
     4. Upon finishing, click Finish to submit the task.
   - To submit the customized task by API methods:
     1. Set the user task class name to the property value of APIConst.TAG_TASK_CLASS.
     2. Define the user task properties with the property APIConst.TAG_USER_TASK_PROP with the formats as follows: jrs.user_task_prop= jrs.rst=result_rtf&jrs.pdf=true&jrs.text=true&jrs.excel=true&jrs.ps=true&jrs.html=result_html. Since the jrs.user_task_prop is used to transfer multiple user task properties, the values set to this property must be formatted to be separated with "&" character.
     3. Set a display name for the class with the property APIConst.TAG_USER_TASK_DISPLAY_NAME.
     4. Except for the above properties, define the other schedule properties as you do with a default task, see APIDemoPublishRpt.java in `<install_root>\help\server\en\samples` for reference. Then following the API demo you can submit a customized task on the server.

###### Related topics:

- Scheduling
- Example 7: Publishing a report set from a User Task