What I’m trying to do
I’m trying to insert a propertly while I’m making the note in templatar. I have a suggestion that supplies me a list of files; I want that string to be a property of the newly created file but it is never filled in.
I can also open another file and perform the operation on it successfully
Any help would be appreciated. Thanks
Things I have tried
const {update, createYamlProperty, getPropertyValue} = this.app.plugins.plugins["metaedit"].api;
const addUpdate = async (field, value, tfile) => {
var exist = await getPropertyValue(tfile);
if (typeof(exist) != 'undefined') {
await update(field, value, tfile);
} else {
await createYamlProperty(field, value, tfile);
}
}
selectedItem = "value"
filename = tp.file.path(true)
console.log(filename);
// Using tp that templater exposes
await addUpdate("<<PROPERTY>>", selectedItem, tp);
// The above statement runs but not reflected in the proeprty.
//The following are accessing an external file and setting the property.
await addUpdate("<<PROPERY>>", selectedItem, tp.file.find_tfile("Applications/file1.md") );
await addUpdate("<<PROPERY>>", selectedItem, tp.file.find_tfile("Applications/file2.md"));
await addUpdate("<<PROPERY>>", selectedItem, tp.file.find_tfile("Applications/file3.md"));
await addUpdate("<<PROPERY>>", selectedItem, tp.file.find_tfile("Applications/file4.md"));
// All the above execute properly
I’m wondering if I need to flush something before running the command in the template.