Select most recent draft in list

When I switch to a new workspace I would like to load up the most recent draft into the editor.

Any ideas as to how I could do this please?

Many Thanks

Flip it round a bit. Create an action to load the draft into the editor and switch the workspace.

Thanks @sylumer I meant load up the latest draft in that workspace (i.e. with the tags that are relevant to that workspace). Does that still apply?

Many thanks

A script to load a workspace, and its first draft would look something like:

// look up workspace
let ws = Workspace.find("MY-WORKSPACE");
// query its inbox drafts
let wsDrafts = ws.query("inbox"); 
// if more than one, load first draft in editor
if (wsDrafts.length > 0) {
// apply the workspace

This is perfect thanks so much!

Typo in the comment above. It should be if one or more, or if more than zero, not if more than one.

@nickwild , this is exactly the sort of approach I was suggesting. You could also consider expanding it.

  • Could you change the start to allow you to choose an existing workspace?
  • Could you add something at the load that prompts if you would like to do something else if no draft is available in the inbox? For example:
    • Create a new draft in the workspace inbox and load it in.
    • Start dictating a new draft into the inbox for the workspace and load it once dictation is complete.
    • Load a draft from the archive instead; if one is available.
    • Display a message that no draft was available to load.

Thanks @sylumer for this.

Quite agree. I actually incorporated this into an action that allows the user to select from a list of existing workspaces and it brings up the most recent draft and it works perfectly :slightly_smiling_face:

Great other ideas too!