In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes:
1. <aclass="reference-link"href="Attributes/Labels.md">Labels</a>can be used for a variety of purposes, such as storing metadata or configuring the behaviour of notes. Labels are also searchable, enhancing note retrieval.
1. <aclass="reference-link"href="Attributes/Labels.md">Labels</a>can be used for a variety of purposes, such as storing metadata or configuring the behaviour of notes. Labels are also searchable, enhancing note retrieval.
For more information, including predefined labels, see<aclass="reference-link"href="Attributes/Labels.md">Labels</a>.
2. <aclass="reference-link"href="Attributes/Relations.md">Relations</a>define connections between notes, similar to links. These can be used for metadata and scripting purposes.
For more information, including a list of predefined relations, see<aclass="reference-link"href="Attributes/Relations.md">Relations</a>.
For more complex scenarios, it is possible to type in a JavaScript expression in order to apply the necessary changes.
The _Bulk Actions_ dialog makes it easy to apply changes to multiple notes at once, ranging from simple actions such as adding or removing a label to being executing custom scripts.
To apply a suffix (`- suffix` in this example), to the note title:
## Interaction
```javascript
note.title = note.title + " - suffix";
```
* The first step is to select the notes in the<aclass="reference-link"href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a>:
* It's possible to apply bulk actions to a single note (and potentially its child notes) simply by clicking on it (with a left click or a right click).
* To select a range of notes, select the start note, hold <kbd>Shift</kbd> and select the end note. The selected notes will appear highlighted in the note tree.
* Right click in the<aclass="reference-link"href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a>and select _Advanced_ → _Apply bulk actions_.
* By default, only the selected notes will be affected. To also include all the descendants of the notes, check _Include descendants of the selected notes_. The number of affected notes at the top of the dialog will update to reflect the change.
* Click on which action to apply from the _Available actions_ section. A detailed description of each is available in the next section.
* For each action selected, the _Chosen actions_ section will update to reveal the entry. Each action will have its own configuration.
* To remove an action, simply press the X button to the right of it.
* It is possible to apply multiple actions of the same type, such as adding multiple types.
* When all the actions are defined, press _Execute bulk actions_ to trigger all of them at once.
* For convenience, the last bulk action configuration is saved for further use and will be restored when entering the dialog again.
To alter attributes of a note in a bulk action, such as setting the `#shareAlias` label to the title of the note:
## Actions
```javascript
note.setLabel("shareAlias", note.title)
```
### Labels
These actions operate the<aclass="reference-link"href="Attributes/Labels.md">Labels</a>of a note:
* **Add label**
* For each note, if it doesn't already have a [label](Attributes/Labels.md) of the given name, it will create it. Keep the _New value_ field empty to create a label without a value, or complete it to assign a value.
* If a note already has this label, its value will be updated.
* **Update label value**
* For each note, if it has a [label](Attributes/Labels.md) of the given name, it will change its value to the specified one. Leave _New value_ field empty to create a label without a value.
* Notes without the label will not be affected.
* _**Rename label**_
* For each note, if it has a [label](Attributes/Labels.md) of the given name, it will be renamed/replaced with a label of the new name. The value of the label (if present) will be kept intact.
* Notes without the label will not be affected.
* **Delete label**
* For each note, if it has a label of a given name, it will be deleted (regardless of whether it has a value or not).
* Notes without the label will not be affected.
### Relations
These actions operate the<aclass="reference-link"href="Attributes/Relations.md">Relations</a>of a note:
* **Add relation**
* For each note, it will create a relation pointing to the given note.
* Notes without this relation will not be affected.
* **Update relation target**
* For each note, it will modify a relation to point to the newly given note.
* Notes without this relation will not be affected.
* **Rename relation**
* For each note, if it has a relation of the given name, it will be renamed/replaced with a relation of the new name. The target note of the relation will be kept intact.
* Notes without this relation will not be affected.
* **Delete relation**
* For each note, if it has a relation of the given name, it will be deleted.
* Notes without this relation will not be affected.
### Notes
* **Rename note**
* For each note, it will change the title of the note to the given one.
* As a more advanced use case, the note can be a “template string” which allows for dynamic values with access to the note information via<aclass="reference-link"href="../Scripting/Script%20API/Frontend%20API/FNote.md">FNote</a>, for example:
* `NEW: ${note.title}` will prefix all notes with `NEW:` .
* `${note.dateCreatedObj.format('MM-DD:')}: ${note.title}` will prefix the note titles with each note's creation date (in month-day format).
* **Move note**
* For each note, it will be moved to the specified parent note.
* As an alternative for less complex situations, the notes can be moved directly from within the<aclass="reference-link"href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a>via cut → paste or via the contextual menu.
* **Delete note**
* For each note, it will be deleted.
* As an alternative for less complex situations, the notes can be removed directly from within the<aclass="reference-link"href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a>by selecting them and pressing <kbd>Delete</kbd>.
* **Delete note revisions**
* This will delete all the<aclass="reference-link"href="../Basic%20Concepts%20and%20Features/Notes/Note%20Revisions.md">Note Revisions</a>of the notes.
### Others
* **Execute script**
* For more complex scenarios, it is possible to type in a JavaScript expression in order to apply the necessary changes.
* Examples:
* To apply a suffix (`- suffix` in this example), to the note title:
```javascript
note.title = note.title + " - suffix";
```
* To alter attributes of a note based on another attribute, such as setting the `#shareAlias` label to the title of the note:
@ -30,4 +30,4 @@ To do so, first select the note to start the selection with. Then hold Shift and

In the right-click menu, operations such as Cut, Copy, Move to, Clone to or Delete will apply to all the selected notes. It is also possible to apply<aclass="reference-link"href="../../Advanced%20Usage/Bulk%20actions.md">Bulk actions</a>to them. The rest of the options will not be available and will appear disabled in the menu.
In the right-click menu, operations such as Cut, Copy, Move to, Clone to or Delete will apply to all the selected notes. It is also possible to apply<aclass="reference-link"href="../../Advanced%20Usage/Bulk%20Actions.md">Bulk actions</a>to them. The rest of the options will not be available and will appear disabled in the menu.
<li>For each note, it will create a relation pointing to the given note.</li>
<li>Notes without this relation will not be affected.</li>
</ul>
</li>
<li><strong>Update relation target</strong>
<ul>
<li>For each note, it will modify a relation to point to the newly given note.</li>
<li>Notes without this relation will not be affected.</li>
</ul>
</li>
<li><strong>Rename relation</strong>
<ul>
<li>For each note, if it has a relation of the given name, it will be renamed/replaced
with a relation of the new name. The target note of the relation will be
kept intact.</li>
<li>Notes without this relation will not be affected.</li>
</ul>
</li>
<li><strong>Delete relation</strong>
<ul>
<li>For each note, if it has a relation of the given name, it will be deleted.</li>
<li>Notes without this relation will not be affected.</li>
</ul>
</li>
</ul>
<h3>Notes</h3>
<ul>
<li><strong>Rename note</strong>
<ul>
<li>For each note, it will change the title of the note to the given one.</li>
<li>As a more advanced use case, the note can be a “template string” which
allows for dynamic values with access to the note information via
<a
class="reference-link" href="../Scripting/Script%20API/Frontend%20API/FNote.html">FNote</a>, for example:
<ul>
<li><code>NEW: ${note.title}</code> will prefix all notes with <code>NEW: </code>.</li>
<li><code>${note.dateCreatedObj.format('MM-DD:')}: ${note.title}</code> will
prefix the note titles with each note's creation date (in month-day format).</li>
</ul>
</li>
</ul>
</li>
<li><strong>Move note</strong>
<ul>
<li>For each note, it will be moved to the specified parent note.</li>
<li>As an alternative for less complex situations, the notes can be moved
directly from within the <aclass="reference-link"href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.html">Note Tree</a> via
cut → paste or via the contextual menu.</li>
</ul>
</li>
<li><strong>Delete note</strong>
<ul>
<li>For each note, it will be deleted.</li>
<li>As an alternative for less complex situations, the notes can be removed
directly from within the <aclass="reference-link"href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.html">Note Tree</a> by
selecting them and pressing <kbd>Delete</kbd>.</li>
</ul>
</li>
<li><strong>Delete note revisions</strong>
<ul>
<li>This will delete all the <aclass="reference-link"href="../Basic%20Concepts%20and%20Features/Notes/Note%20Revisions.html">Note Revisions</a> of
the notes.</li>
</ul>
</li>
</ul>
<h3>Others</h3>
<ul>
<li><strong>Execute script</strong>
<ul>
<li>For more complex scenarios, it is possible to type in a JavaScript expression
in order to apply the necessary changes.</li>
<li>Examples:
<ul>
<li>
<p>To apply a suffix (<code>- suffix</code> in this example), to the note
<p>To alter attributes of a note based on another attribute, such as setting
the <code>#shareAlias</code> label to the title of the note:</p><pre><codeclass="language-application-javascript-env-backend">note.setLabel("shareAlias", note.title)</code></pre>