# Automation Tutorial (https://21notion.com/en/docs/advance-feature/automation)

## Description

All Database automations listed on this page require a paid Notion subscription.

![Notion subscription plan pricing comparison display](https://pic.eryinote.com/PicGo/202510302126991.png)

## Task-related Automation

<Accordions type="single">
  <Accordion title="Automatically Relate Task to Project's sub-Area" id="task-auto-assign-project-subarea">
    **Effect Description**

    When creating a \[Task] in the Task Database within \[Project], automatically relate that \[Task] to the \[sub-Area] that the \[Project] belongs to.

    **Implementation**

    1. Find the automation settings for the Task Database

    ![Task database automation settings entry interface](https://pic.eryinote.com/PicGo/202510302126387.png)

    2. Create an automation action as shown in the image

    **Set Trigger**

    ![Automation trigger condition configuration dialog](https://pic.eryinote.com/PicGo/202510302127240.png)

    **Add Action - Define Variable**

    As shown in the image, name the variable "Project's sub-Area"

    ![Automation variable definition mapping project area](https://pic.eryinote.com/PicGo/202510302114287.png)

    The [`map()`](/notion-formulas/functions/map) function shown here takes the related Project and returns its sub-Area.

    **Add Action - Edit Property**

    ![Automation add operation edit property menu](https://pic.eryinote.com/PicGo/202510302116488.png)

    Then find the \[sub-Area] property, click it, and select \[Custom Formula] from the pop-up menu

    ![Property editing interface selecting custom function](https://pic.eryinote.com/PicGo/202510302117225.png)

    Then in \[Custom Formula], find and click the variable "Project's sub-Area" you just defined, then click close

    ![Custom function referencing defined variable](https://pic.eryinote.com/PicGo/202510302118187.png)

    The complete flow is shown in the image below. After confirming everything is correct, click the "Enable" button

    ![Automation complete workflow enable confirmation button](https://pic.eryinote.com/PicGo/202510302120112.png)

    Note that to implement this automation flow, the Project must first be related to a sub-Area. If when you create a Task, the Project is not related to a sub-Area, automatic relation cannot be achieved, or rather the automation has been triggered but because the "Project's sub-Area" variable is empty, the Task's sub-Area will also be empty.
  </Accordion>

  <Accordion title="Should notes automatically inherit tasks, projects, and areas?" id="note-auto-inherit-task-project-area">
    **When this is worth considering**

    When you create a note inside a task, you may want that note to automatically relate to the current task, then inherit the task's related Project, the Project's sub-Area, and the parent Area.

    **My recommendation**

    I do not recommend setting up global automatic inheritance from the start. Notes and tasks often appear together, but a note's final Project or Area does not always match the task's chain. If everything is filled automatically, you may end up with many weak relations that look organized but do not carry much meaning.

    A steadier approach is:

    1. If the note is created from a task, relate it to the task first and set the note type
    2. If you often need to review by Project or Area later, then consider inheriting the Project and sub-Area automatically
    3. If this only happens occasionally, keep it manual instead of building a global automation
    4. If you are sure this chain is needed every time, use the automation method above, but Notion database automations require a paid Notion plan

    The parent Area can usually be reviewed through the sub-Area, so every note does not need to relate to the parent Area directly.
  </Accordion>
</Accordions>
