Templater duplicate tp.system.prompt dialogue when creating new note from templater command

What I’m trying to do

I’m trying to use a templater command to create a new note from a template. Within the template is a tp.system.prompt() command meant to take user input for a field in the frontmatter on creation of the note.
When I run the code block below, the note is created as expected, however I am prompted twice for the same field with identical prompts.

const template = tp.file.find_tfile("prompt template")
tp.file.create_new(template, "New prompt", true)

“prompt template.md”:

value: <% tp.system.prompt("Enter Value") %>

Things I have tried

I searched the forum for duplicate templater prompt dialogue, but did not find any relevant solutions.
I tried creating a new note by setting “prompt template.md” as the default template for a folder and creating the note with the new note button, which worked as expected, prompting me only once, so it seems to be an issue with the command, not the template.
Fiddling around with the dialogue boxes, I also found that the second value always overwrites the first, even if the second is null. I’m not sure if that helps to diagnose the issue though.
I turned off “Trigger Templater on new file creation” in the settings and was prompted only once and the value was populated as expected. This is not an ideal solution for me however, because it is necessary for folder templates which I would like to be able to use. Maybe there is a way to turn it off only when running this particular note creation command?

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