Skip to content
Actions for Obsidian icon Home Actions for Obsidian 2024.2.1 › Actions

Actions for Obsidian › Actions › Set Note Properties

Overwrites or updates a note's properties, and saves the note.

Parameters

Vault

The vault to work in.

Type: Vault reference

Note Lookup

Specify which note should be looked up or manipulated by the action:

  • "note": If you want to use another AFO action’s Note result, pick this option.
  • "note at file path": The full path of the note, should be used if you already know the full file path (including folder and file extension).
  • "note with UID": Use this if you are using unique identifiers for your notes, and you prefer to look them up by the UID.
  • the current Periodic Note (daily, weekly, etc.)

Options:

  • note
  • note at file path
  • note with UID
  • Daily Note
  • Weekly Note
  • Monthly Note
  • Quarterly Note
  • Yearly Note

File Path

The path of the note, relative to the vault root.

Only available when Note Lookup is set to "note at file path".

Type: Text

UID

The unique identifier of the note. To configure the frontmatter key that is used for the lookup, go into Obsidian's settings, section "Community plugins", and find Actions URI.

Only available when Note Lookup is set to "note with UID".

Type: Text

Obsidian Note

A Note that was returned by another AFO action.

Only available when Note Lookup is set to "note".

Type: Note reference

Dictionary

Pass in a Shortcuts Dictionary here. The action will only process dictionary keys whose values are valid Obsidian Property types: string, list of strings, number, and boolean. (Date and Date & Time properties are represented as string values.) Everything else, e.g. dictionary values, lists containing anything other than strings, will be ignored. Just like in Obsidian, nested properties are not supported.

Hint: On Mac, you can right-click any parameter field. That'll bring up the context menu, in which you'll find the defined variable from previous steps/actions. On iPad, long-tapping does the same thing.

Type: Dictionary

Mode

You can replace everything, meaning all of the note's properties will be replaced with the new ones. Or you can update the existing properties, meaning those keys from the passed-in properties that are new will be added to the note, those that are existing will be replaced, and any other will be left untouched.

Options:

  • replace everything
  • add new keys, update existing

Open or focus note

If enabled, after a successful operation, the note will be brought to the front in Obsidian.

Type: Boolean (YES/NO)

Return Value

Note reference

How it works

In absence of a dedicated Obsidian API method for writing properties (AFAICT), Actions for Obsidian will translate the passed-in dictionary into front matter YAML, and then replace the old front matter. Obsidian will pick up the file change and populate the note's properties from the changed front matter. Exactly how Obsidian interprets those values (as text, a list of texts, a number, or a checkbox) is up to you, and it can only be specified in Obsidian itself — please see the official Property doc page for more details.

Example

The the example below, I've used a Dictionary action to set up a Shortcuts dictionary data structure:

KeyTypeValue
modifiedAtTextCurrent Date (the built-in variable)
listArraythree Text entries: "one", "2", "three"
checkboxBooleanFalse
ohNoDictionary"keyOne": "one" (a text), "keyTwo": 2 (a number)

The result of this action is used in the Set Note Properties action for my note "Hello.md" in my vault "Workbench", as input for the parameter "Dictionary":

When the workflow is executed, Set Note Properties causes Obsidian to update the note with the three key/value pairs "modifiedAt", "list", and "checkbox" because they use valid value types. The key/value pair "ohNo" is ignored because its value is neither a text, nor a list of texts, nor a number, nor a boolean.