Hi all,
I am trying to implement an action that queries my drafts for the string ‘@due([todaysdate])’ as part of my plans to use Drafts for task management. (If anyone is interested, I have an action that will schedule a draft by updating or inputting that string based on a selected date from the Date Picker prompt).
This new action is based of the ‘Go to today’s journal’ action in the directory and adds all due drafts to my journal. Now my issue is, the Drafts are found correctly using RegEx and querying (ie the correct number are returned based on tests), however when I then try to access the title, displayTitle, lines, uuid etc, in order to place in in the new draft, all I get is ‘undefined’ for all data?
Here is my JavaScript code:
var date = Date.today().toString("dd-MM-yyyy");
var bjTitle = "# Journal for " + date;
var tag = "journal";
var drafts = Draft.query(bjTitle, "all", [tag]);
var scheduled = Draft.query('@due(' + date + ')', 'all')
var dueDrafts = '## Due Today\n'
for (due in scheduled) {
dueDrafts = dueDrafts + due.title + due.uuid + due.lines + '\n'
}
Based on logging the attributes of ‘due’ here (eg due.title) - all = ‘undefined’, for all drafts…
I can program however not in JavaScript so might be missing something here… any help would be appreciated!