Create a new note from template passing parameters


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…

Any idea?


1 Like

I have the excact same issue. Did you come up by a solution?

1 Like

Have you seen the thingy?

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 tried this but got stucked.

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?




refnr: [[Note A]]

new note template

 let  active_file = tp.config.active_file;

title:: <%active_file.tags.title%>
1 Like

fwiw, i’d love to understand how to do this as well…would vastly improve my work flow

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.

This brings me close but I dont understand the lastFile. Its not the file I open and activate the templater from.

templater file:

let new_titel ="YYYY-MM-DD_HHmm")
await tp.file.move("daily notes/" +"YYYY") +  "/" +"MM") + "/" + new_titel)
let files =;
let lastFile =[0]);
refnr:: [[<%lastFile.basename%>]]

QuickAdd is very powerful but I’m not sure how to achieve what I want. I want to create a new note with no prompt for note title etc.

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 object.

case note 1 templater file:

   const dv =["dataview"].api;
	let refnr = tp.file.title.slice(4,10);
   const fooMeta =
   let new_titel ="YYYY-MM-DD_HHmm")
   await tp.file.move("daily notes/" +"YYYY") +  "/" +"MM") + "/" + new_titel)
type: case_note
titel: <% fooMeta.titel %>
refnr:: [[<%refnr%>]]

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.