Action

Remind me of this draft in Due

Posted by @derekvan, Last update about 6 years ago

Creates a reminder of a draft with a link in the notes of a task in due. Optional to set a time. Based on script by @nahumck https://actions.getdrafts.com/a/1Ds

Steps

  • script

    // Get link to draft
    var url = draft.permalink;
    
    // Prompt for date with toggle for reminder
    var p = Prompt.create();
    p.title = "Remind about what? When?";
    p.addTextField("title", "Title", draft.title);
    p.addTextField("when","When?",draft.when);
    p.addButton("Send to Due");
    var con = p.show();
    
    var title =  p.fieldValues["title"];
    var when = p.fieldValues["when"];
    
    var reminder = title + " " + when + "      " + url;
    
    const baseURL = "due://x-callback-url/add?";
    
    var cb = CallbackURL.create();
    cb.baseURL = baseURL;
    cb.addParameter("title", reminder);
    
    var success = cb.open();
    
    if (success) {
             console.log ("Done!");
             }
    else  {
    	   console.log(cb.status);
    	   	if(cb.status == "cancel"){
    	   			context.cancel();
    	   }
    	   else {
    	   		context.fail();
    	   		}
    	   }

Options

  • After Success Default
    Notification Info
    Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.