> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduled tasks

> Scheduled tasks

In the **Scheduled tasks** tab you can specify that a script or macro should be run at specific times.

<Tip>
  Time-consuming tasks should be scheduled at times when few people are using SuperOffice.
</Tip>

Click a task in the list to edit its properties, such as when it was last executed, execution time and sent/received objects.

## Create a new scheduled task

1. Go to **Settings and maintenance**.

2. Click **CRMScript** and select the **Scheduled tasks** tab.

3. Click **New task**.

4. Select how often the task should be performed, in the **Frequency** list. **Run after another schedule** can be used to start a task after another task has completed. You can use this option to chain tasks together.

5. Click **OK**.

6. Fill in the following fields in the **Properties** tab:
   * **Name**: Enter a name for the task.
   * **ejScript/CRMScript**: Select the script or macro to use in the task.

7. Click **Apply** and go to the **Schedule** tab.

8. Select **Start now** to run the task the next time the system checks for scheduled tasks (normally withing 1 minute).

9. Select **Disable** if the task should be inactive for the time being.

10. Edit the schedule. The available fields will depend on the selected frequency:

    * **Never**: The task does not run unless you select **Start now**.
    * **Minute interval**: The task runs at the selected interval (in minutes). Make sure the interval is longer than the time it takes to run the task.
    * **Hourly**: The task runs hourly, at X minutes past the hour.
    * **Week interval**: The task runs weekly. Enter the time and on which day(s) the task should be run.
    * **Month interval**:The task runs monthly. Enter the time, on which day of the month, and in which month(s).
    * **After**: The task runs at the set date and time.
    * **Run after schedule**: The task runs when the selected scheduled task is complete. You can use this option to chain tasks together.

11. Set **Lock time in minutes** to prevent multiple tasks from the same schedule to run at the same time. You should set this value higher than the expected run time for your task. If your task takes more time than specified here, it is considered failed, and a new task from the same schedule is allowed to run.

12. Set **Minutes before restart after error**. This setting specifies the time before a failed task (a task that has crashed) will be re-run.

13. Click **OK**. The task is added to the list, and you can see the status and time of the next execution of the task.


## Related topics

- [Best practices](/en/automation/crmscript/code-quality/best-practices.md)
