User Scripts in Templater

Things I have tried

I am facing issues with running user scripts using the Templater community plugin.
I followed the instructions step by step here: How To Use Templater JS Scripts - Obsidian Publish

I created a ‘Templaters’ folder and created a file called Notice where I the following template:
<%* tp.user.notice(tp) %>

I also created a Scripts folder and created a notice.js file where I put the following:
async function notice(tp) {
const text = await tp.system.prompt(“What’s Good?”)
new Notice(text, 5000)
module.exports = notice

I then tried to insert the Notice template into a new file but got the following error: Template parsing error, aborting. tp.user.notice is not a function.

Hope to get some help on this!
p.s. I’ve ensured that my settings are correct i.e. specifying the scripts folder and templaters folder.

Thank you!

You might want to cross-post on the Templater GitHub page for help:

Okay! Will do! Thanks Ryan!

It is case-sensitive. Make sure the template is the same case as the title of the js file. I attempted this, and it works fine.

Hi jwl,

Tried ensuring the same case but still does not seem to work. Tried deleting and reinstalling the plugin to no avail. Any other tips?

Thank you!

Will you post a screenshot of your settings?

Hi jwl,

Thanks for taking the time to help me with this!
I’ve attached my folder structure as well as all the settings in templater.

Thank you!

From what I can see, it seems that the error may be with your notice.js file. For example, line 3 should have notice in lowercase rather than uppercase.

Try this.

async function notice(tp) {
    const text = await tp.system.prompt("What's Good?")
    new notice(text, 5000)

module.exports = notice

Unfortunately, I am still getting the same error. Is it possible for you to show me screeenshots of how you are doing it so that I can attempt to replicate 1 for 1?

Thank you!

"Notice" on line 3 needs to remain capitalized. I was incorrect in an earlier suggestion.



I am using Garuda Linux as my OS and this version of Obsidian ↓ ↓


Hi jwl,

Thanks so much for your help! After looking at your images, I realised my notice.js wasn’t being saved as a javascript file.

Thanks once again!

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