TIP: Use temporary workspaces to filter the draft list


Workspaces are a great tool to define a filtered view of the draft list, but sometime you have searches/filters you only want to apply occasionally, or which are based on inputs that change - like input from a prompt in an action.

This Load Temporary Workspace action is a demonstration of something enabled by the recent addition of Workspace scripting.

It is now possible to create a workspace in script, define its various tag filters, query string, sort options, etc., and apply it to the draft list without ever saving that Workspace - so it will not be added to your Workspaces list.

Download the example action. Including the script below as well:

// BEGIN config variables
// setup tags or searches you wish to load...
let name = "Blue Things";
let tagFilter = "blue, !green"
let queryString = "";
// END config variables

// create workspace
// for other options, see:
// https://reference.getdrafts.com/objects/Workspace.html
let ws = Workspace.create();
ws.name = name;
ws.tagFilter = tagFilter;
ws.queryString = queryString;
ws.setInboxSort("modified", true);

// unless you call `ws.update()`, this ws is temporary
// load this workspace, and display draft list



See, I told you you needed to beef up Workspace. :slight_smile:

Seriously, this is a nice example of a query.

I’ll have to read up more on the new enhancements to Workspace.


The documentation on that page needs a little finishing:

  • name [string]
    The name of the workspace.
  • queryString [string]
    The name of the workspace.
  • tagFilter [string]
    The name of the workspace.
  • tagFilterRequireAll [boolean]
    The name of the workspace.


Just for info - same in the beta documentation site too.


Fixed the docs, thanks.