# On Completion
> [!tip]
> If you have ever wished that Tasks would automatically *do something* with the tasks that you complete (*especially* likely if you use [[Recurring Tasks|recurring tasks]], which tend to accumulate within the note that holds them), then the **"On Completion"** feature could be the answer!
> [!released]
> Introduced in Tasks 7.8.0.
## Introduction
Obsidian Tasks can automatically perform an action upon a task when it is marked 'done'.
This feature is enabled by adding (*after* the description within a task) a field consisting of:
- the *checkered flag* π emoji ***signifier***, followed by
- a string identifying the desired ***action*** to take when the item is completed.
> [!info]
> If you are using [[Dataview Format]] for Tasks, instead of the π emoji the desired ***action*** would follow the double colons in `[onCompletion:: ]`.)
## Supported actions
At present, these "On Completion" ***actions*** are supported:
| Action | Behaviour |
| ---------- | --------------------------------------------------------------------------------- |
| **Keep** | Nothing will be done with the just-completed task. (This is the default action.) |
| **Delete** | Removes the completed instance of the task. |
> [!tip]
> Several additional ***actions*** are being considered for future implementation, namely moving a just-completed task to:
>
> - a separate "completed tasks archive" note,
> - see [issue #2855](https://github.com/obsidian-tasks-group/obsidian-tasks/issues/2855)
> - a "completed tasks list" within the original host note,
> - see [issue #2856](https://github.com/obsidian-tasks-group/obsidian-tasks/issues/2856)
> - the end of the list.
> - see [discussion #2426](https://github.com/obsidian-tasks-group/obsidian-tasks/discussions/2426).
## Worked examples
### Demos
> [!info]
> In order to keep it simple, the following assumes that **Tasks** is configured so as not to use a [[Global Filter]] nor add a [[Dates#Done date]] when you complete a task.
> [!example] Imagine that your vault consists of a single note file `My Project.md`, with these contents:
>
> ```text
> # My Project Tasks
> - [ ] Leave me alone
> - [ ] Leave me alone too! π keep
> - [ ] Delete me upon completion π delete
> - [ ] Delete my completed instance, leave my next instance π
2021-05-20 π every day when done π delete
> ```
> [!success] Using the plugin's default settings, after *using Tasks* to mark each task as "done", your `My Project` note file will contain:
>
> ```text
> # My Project Tasks
> - [x] Leave me alone
> - [x] Leave me alone too! π keep
> - [ ] Delete my completed instance, leave my next instance π
2021-05-21 π every day when done π delete
> ```
> [!note] Note that
>
> - The task assigned the `keep` action is treated the same as one that has no onCompletion field at all, and
> - The next instance of the recurring task has replaced the original, completed instance.
### Do not break your nested tasks
> [!warning] ***Never, ever*** put `π delete` on a task that has [nested tasks or list items](https://help.obsidian.md/Editing+and+formatting/Basic+formatting+syntax#Nesting+lists), also known as child items, or sub-items.
>
> Don't do this:
>
> ```text
> - [ ] Delete me upon completion π delete
> - [ ] I am a nested task
> - I am a nested list item.
> ```
>
> When that first task is completed, the text will become:
>
> ```text
> - [ ] I am a nested task
> - I am a nested list item.
> ```
>
> Those two lines are now indented, which means they now form a code block, not a list!
>
> | Before: 2 tasks and a list item | After: No tasks, just a code block |
> | ------------------------------- | ---------------------------------- |
> | ![[on-completion-before.png]] | ![[on-completion-after.png]] |
>
> Tasks does not yet issue any warnings if this happens.
## Assigning and changing a given task's "On Completion" action
The "On Completion" signifier and desired **Action** identifier can be added with [[Auto-Suggest]], to save typing them manually.
We will also eventually enable the [[Create or edit Task|'Create or Edit Task' modal dialog]] to edit the "On Completion" **Action**.