Set Note Properties
Overwrites or updates a note's properties.
A Note object.
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.
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.
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.
The the example below, I've used a Dictionary action to set up a Shortcuts dictionary data structure:
|ohNo||Dictionary||"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 you run the workflow, 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.
Changes / History
Action was introduced. 🐣