Trouble with Templater: Template parsing error

What I’m trying to do

Hello everyone,

I’m currently trying to automate the process of creating intervention notes in Obsidian using the Templater plugin. However, I’m encountering some difficulties and I hope someone could provide some advice.
I want to create a note for each intervention that includes the following:

  1. The name of the intervenant (speaker) should be automatically linked to a pre-existing note (or create a new one if it doesn’t exist).
  2. I want to easily select a domain (e.g., “Métiers”, “Équipement”, “Vente”) for each intervention.
  3. The date of the intervention should be manually entered.

Things I have tried

This is what I’m working with :

---
intervenant: "<% tp.user.input('Nom de l\'intervenant') %>"
date: "<% tp.date.now('YYYY-MM-DD') %>"
tags:
  - <% tp.user.input('Domaine (par exemple, Métiers, Équipement, Vente)') %>
---

# <% tp.file.title %>

- [[<% tp.user.input('Nom de l\'intervenant') %>|🎤 Informations sur l\'intervenant]]
- [[#📝 Résumé|📝 Résumé]]
- [[#📌 Notes détaillées|📌 Notes détaillées]]
- [[#🔥 Points clés à retenir|🔥 Points clés à retenir]]
- [[#❓ Questions ouvertes|❓ Questions ouvertes]]
- [[#🔗 Liens et ressources|🔗 Liens et ressources]]

## 🎤 Informations sur l'intervenant  
- **Nom** : [[<% tp.user.input('Nom de l\'intervenant') %>]]
- **Domaine** : <% tp.user.input('Domaine (ex : Métiers, Équipement)') %>
- **Date** : <% tp.date.now('YYYY-MM-DD') %>

## 📝 Résumé  
...

## 📌 Notes détaillées  
...

## 🔥 Points clés à retenir  
...

## ❓ Questions ouvertes  
...

## 🔗 Liens et ressources  
...

And this is what I get in the console :
Templater Error: Template parsing error, aborting.
tp.user.input is not a function

So I’ve tried other functions :

---
intervenant: "<%* tp.user.input('Nom de l\'intervenant') %>"
date: "<% tp.date.now('YYYY-MM-DD') %>"
tags:
  - <%* tp.user.input('Domaine (par exemple, Métiers, Équipement, Vente)') %>
---

# <% tp.file.title %>

- [[<%* tp.user.input('Nom de l\'intervenant') %>|🎤 Informations sur l\'intervenant]]
- [[#📝 Résumé|📝 Résumé]]
- [[#📌 Notes détaillées|📌 Notes détaillées]]
- [[#🔥 Points clés à retenir|🔥 Points clés à retenir]]
- [[#❓ Questions ouvertes|❓ Questions ouvertes]]
- [[#🔗 Liens et ressources|🔗 Liens et ressources]]

## 🎤 Informations sur l'intervenant  
- **Nom** : [[<%* tp.user.input('Nom de l\'intervenant') %>]]
- **Domaine** : <%* tp.user.input('Domaine (ex : Métiers, Équipement)') %>
- **Date** : <% tp.date.now('YYYY-MM-DD') %>

## 📝 Résumé  
...

## 📌 Notes détaillées  
...

## 🔥 Points clés à retenir  
...

## ❓ Questions ouvertes  
...

## 🔗 Liens et ressources  
...

And then these ones :slight_smile:

---
intervenant: "<% tp.prompt('Nom de l\'intervenant') %>"
date: "<% tp.date.now('YYYY-MM-DD') %>"
tags:
  - <% tp.prompt('Domaine (par exemple, Métiers, Équipement, Vente)') %>
---
---
intervenant: "<%* tp.user.prompt('Nom de l\'intervenant') %>"
date: "<% tp.date.now('YYYY-MM-DD') %>"
tags:
  - <%* tp.user.prompt('Domaine (par exemple, Métiers, Équipement, Vente)') %>
---

I have the latest version of Templater but otherwise I don’t really understand what I’m doing wrong.

I think you might be looking for tp.system.prompt() or potentially tp.system.suggester() (for n°2) :blush: … and I think both might need an await iirc (:sweat_smile:)

For n°1 though, it’s probably going to require a bit more code, as once you input the name of the speaker, you should then need know if a note concerning that specific speaker already exists or not… and from there either create it or not…

So you’ll most likely need to store the value of the tp.system.prompt() for the speaker in a const, so you can easily use and re-use it where and when needed and a if... else logic :blush: .

This snippet from Zachatoo could give you, maybe, a lead to follow: Create file if it doesn’t exist, I think :blush: .

I hope this helps a little :innocent:

Thank you very much for your reply ! I’m not sure to understand what that means though ?

Do you think there is an alternative, maybe one that doesn’t use Templater ? I don’t seem to make it work for any functions :confused: I’ve tested it with the basic ones and it doesn’t work either.

I will go check that out ! Thanks again