Tag Assign or Filter

Posted by @derekvan, Last update over 5 years ago

Combines Tim Nahumck’s excellent “update tags” action ( and Greg’s excellent “temporary workspace” action (

Basically, you get a menu of tags and you can select some tags which will either a) update the current draft’s tags based on your selection; or b) filter the drafts list by those tags.

You can also write in new tags via the “other” field; write a search query via the search field; and archive the draft after updating its tags.

Edit the script on line 6 to write in your own tags


  • script

    // choose tags or filter by tags 
    // show multi-select with current assigned tags
    // and a static list of common tags
    // baseTags are always visible.
    var baseTags = ["tag1", "tag2", "tag3"];
    var currentTags = draft.tags;
    var allTags = baseTags.concat(currentTags);
    var selectableTags = Array.from(new Set(allTags));
    // create prompt to display
    var p = Prompt.create();
    p.title = "Assign tags";
    p.addSelect("tags", "", selectableTags, currentTags, true);
    p.addTextField("othertags", "Other", "", {
      "placeholder": "comma-separated tags",
      "autocapitalization": "none"
    p.addTextField("qs","Query","", {
      "placeholder": "type search terms here",
      "autocapitalization": "none"
    if ( {
    	if (p.buttonPressed == "Update") {
    		var selectedTags = p.fieldValues["tags"];
       		for (var tag of currentTags) {
    		for (var tag of selectedTags) {
    		var otherTags = p.fieldValues["othertags"].split(",");
    		for (var tag of otherTags) {
    	if (p.fieldValues["archive"] == true) {
       		draft.isArchived = true;
    else if (p.buttonPressed == "Filter") {
    // BEGIN config variables
    // setup tags or searches you wish to load...
    let name = "Tag Filter";
    var selectedTags = p.fieldValues["tags"];
    var tagfilter = selectedTags.toString();
    var qs = p.fieldValues["qs"];
    // END config variables
    // create workspace
    // for other options, see:
    let ws = Workspace.create(); = name;
    ws.tagFilter = tagfilter;
    if (qs) {
    	ws.queryString = qs;
    ws.setInboxSort("modified", true);
    // unless you call `ws.update()`, this ws is temporary
    // load this workspace, and display draft list


  • 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.