I have a PKM where some notes represents COMPANIES and others PEOPLE working for this companies.
I would like to have a button called “Create People” in the COMPANY note that automatically creates a new PEOPLE note (based on PEOPLE_TEMPLATE) with a backlink to the COMPANY note.
I’m using “templater” and “obsidian button maker plugin” but I’m not able to pass the name of the company to the new note.
The only solution I found is create a note with the name of the company and then, via javascript, grab it and put in the note and rename the new note with the name of the person… but it’s complex, fragile and prone to errors…
Not sure if this triggered when hitting a button, but it seems like it would be natural, so then you get that file (and have access to all fields/information from it).
I not sure how to extract e.g. note titel from the tp.config.active_file object.
From the example below I would like to create NoteB from a template called when NoteA is active?
NoteA
title::blablabla
NoteB
refnr: [[Note A]]
title::blablabla
new note template
<%*
let active_file = tp.config.active_file;
-%>
title:: <%active_file.tags.title%>
summary::
refnr::[[<%active_file.title%>]]
I use qucikadd which works with templater. look at the quickadd docs about using both. i assign a hotkey to the action to create the note. quick add can prompt for input.
I’ve dabbled a little with various ways to create new notes, and that triggers the various options discussed here differently. So for us to help you the best, could you please describe exactly how you would like it to be?
Do you start with hitting a link to a file not created yet? Do you hit a hotkey to create the new file? Do you have setup stuff which triggers templates on creation of new files? Do you hit a hotkey to insert the template? Could you provide the code for your button? Are the company note in the same folders, as the people notes? How does your way of creating files differ, @gianx and @atomman?
If you give a precise description of the steps you want to take, and the result you would like out of it (even though it’s not happening like that today), it would be easier for me (and others) to recreate that, and do proper tests to achieve your end goal.
I have solved my issue and possibly also @gianx issue.
Im using the buttons plugin to create a new note from a template with backlink to parrent file by the push of a button.
The buttons code for a specific case note has the following syntax in my case template file.
name case_note
type note(tmp-<%tp.file.title%>) template
action case note 1
templater true
This ensures that the button creates a note called tmp-<CASEID> from a template called case note 1 which will pull the CASEID from the title and insert it as a backlink. In addition Im passing metadata (a field called titel) from the parent not to the child via DataviewAPI.page object.