Action

move draft

Posted by FlohGro, Last update 21 days ago

depending on the current „folder“ and state of the draft a prompt will be shown to move the draft.

Steps

  • script

    
    // move draft
    
    var lists = [];
    
    if (draft.isArchived == true) {
      lists.push("inbox");
      lists.push("flag / unflag");
      lists.push("trash");
    }
    
    if ((draft.isArchived == false) && (draft.isTrashed == false)) {
     lists.push("flag / unflag");
      lists.push("archive");
      lists.push("trash");
    }
    
    if (draft.isTrashed == true) {
      lists.push("inbox");
      lists.push("archive");
    }
    
    var p = Prompt.create();
    p.title = "select action";
    p.message = "for draft \"" + draft.title + "\"";
    
    for (var list of lists) {
      p.addButton(list);
    }
    var con = p.show();
    
    if (con) {
      var sel = p.buttonPressed;
      if (sel == "archive") {
        draft.isArchived = true;
      } else if (sel == "inbox") {
        draft.isArchived = false;
      } else if (sel == "trash") {
        draft.isTrashed = true;
      } else {
        if (draft.isFlagged == true) {
          draft.isFlagged = false;
        } else {
          draft.isFlagged = true;
        }
      }
      draft.update();
    } else {
      context.cancel();
    }
    

Options

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