Changing "Open Today's Journal Note" default location #5879
-
Hello, When I press "Open Today's Journal Note" it saves it in the following directory structure I wish for the note to be created at the root level of Journal instead i.e. Any help is appreciated and please forgive my ineptness |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 10 replies
-
Hi @SpaceRaceMouse! I'm Dosu and I’m helping the Notes team. Yes, you can change where "Open Today's Journal Note" creates new notes by setting the calendar root. To do this, apply the label If you want even more control, you can use a custom launch bar script to specify exactly where the note should go. Here’s an example script you can use in the launch bar: const noteId = await api.runOnBackend(() => {
const journalRootId = 'YOUR_JOURNAL_NOTE_ID'; // Replace with your Journal note's ID
const rootNode = api.getNote(journalRootId);
const todayNode = api.getTodayNote(rootNode);
return todayNode.noteId;
});
await api.waitUntilSynced();
await api.activateNote(noteId); Replace To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
Thanks @dosu I have managed to create the script note with the above code. This does create a new note but it creates it in the exact same structure as the original "Open Today's Journal Note" button. Is there a way I can adjust the code to change the structure so the note isn't created within subfolders. |
Beta Was this translation helpful? Give feedback.
The errors are happening because:
api.runAsyncOnBackendWithManualTransactionHandling()
expects an async function with manual transaction handling, but your function is synchronous—so Trilium suggests usingapi.runOnBackend()
instead.Cannot destructure property 'becca' of 'undefined'
) happens because the backend function you pass toapi.runOnBackend()
orapi.runAsyncOnBackendWithManualTransactionHandling()
does not receive any parameters by default. You should access backend APIs (likeapi.getNote
,api.createTextNote
) directly via the providedapi
object, not by destructuringbecca
from parameters.Here’s a corrected script that creates or opens today’s note di…