Action
Save Tasks into New Todoist project
Modified version of action described below
Create tasks in a particular Todoist for each line of the current draft.
You can adapt the targeted project in the script’s first line. [replace ‚Einkaufszettel‘ with your project‘s name]
based on sylumer’s workaround: https://forums.getdrafts.com/t/todoist-quick-add-group/666/6
Steps
-
script
// create task in Todoist inbox for each line in the draft //Initialise let todoist = Todoist.create(); let ctErrors = 0; //Set the project name and create it let strProject = draft.title.replace(/^(#* )/, ""); todoist.createProject({"name" : strProject}); //Process Lines let lines = draft.content.split("\n"); for (let line of lines) { if (line.length > 0 && !line.startsWith("#")) { let success = todoist.quickAdd(line + " #" + strProject); if (success) { console.log("Todoist task created: " + line); } else { ctErrors++; console.log("Todoist error: " + todoist.lastError); } } } if (ctErrors > 0) { context.fail(); }
Options
-
After Success Default Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.