Use quick add to create a new meeting note and insert a link to another file by matching a property
I have a folder of People. Each person has a nickname.
In quick-add I create a new meeting note with the filename format such as: Nov_30_2024_FirstName
I want to create a link in this new note to the person using the first name which is part of the filename. The first name would match to the nickname property in the files under People/. This would look like participant:: [[First Last]]
Things I have tried
I tried embedding calls to dataview apis without luck even though my dataview query is correct.
I.e. you insert js quickadd code block into your template and then use return to write text. To get more specific help, send the dataview related code which has to be in JavaScript format.
// I already had a prompt from quick add to create the new file with the firstname.
// This is redundant and shouldn't be needed.
const input = await this.quickAddApi.inputPrompt("Participants")
// for testing I hard code a name rather than use ${input}
// as a dataview query this works fine
const query = `
LIST
FROM "People"
WHERE nickname = "Joe"
`;
const dataviewApi = app.plugins.plugins["dataview"].api;
const result = await dataviewApi.query(query);
if (result && result.length > 0) {
// access the first element
const link = result[0][0];
return `participants:: [[${link}]]`;
} else {
return `No file found for participant: ${query}`;
}