Assign Draft to Workspace

Posted by davenicholls, Last update about 4 years ago

This is a slightly reworked version of agiletortoise’s “New Draft in Workspace” action (

It allows you to choose a workspace and it assigns the tags to the current draft. Note that all existing tags are removed first.

It can be used to move a draft to a new workspace, but was mostly created because I keep forgetting to use Greg’s action to create drafts with the right tags


  • script

    // Assign current draft to selected workspace
    let f = () => {
    	let workspaces = Workspace.getAll();
    	if (workspaces.length == 0) {
    		alert("No workspaces defined.");
    		return false;
    	let p = Prompt.create();
    	p.title = "Assign Draft to Workspace";
    	p.message = "Select workspace. Current draft will be assigned tags to match the workspace.";
    	let ix = 0;
    	for (let ws of workspaces) {
    		if (ws.tagFilter.length > 0 && ws.tagFilter.trim() != "untagged") {
    			p.addButton(, ix);
    	if (! {
    		return false;
    	let selectedIndex = p.buttonPressed;
    	let ws = workspaces[selectedIndex];
    	for (var tag of draft.tags) {
    	let tags = ws.tagFilter.split(",").filter(tag => tag.trim().length > 0 && tag.trim()[0] != "!" && tag.trim() != "untagged")
    	for (var tag of tags) {
    	return true;
    if (!f()) {


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