Action

Count Template Tag Drafts

Posted by sylumer, Last update about 2 years ago - Unlisted

Steps

  • script

    	// Output details of direct search
    	let strMsg = "DIRECT\n======\n";
    	strMsg = strMsg + "Drafts tagged with 'template': " + Draft.query("", "all", ["template"], [], "created", false, false).length.toString();
    	strMsg = strMsg + "\n\n\n\n";
    
    	// Build workspace
    	let workspace = Workspace.create();
    	if (!workspace) {
    		alert("Workspace not created");
    	}
    	workspace.tagFilter = "template";
    	workspace.setAllSort("name", false, true);
    
    	// Get list of drafts in workspace
    	let wsDrafts = workspace.query("all");
    
    	// Build output details of  workspace
    	strMsg = strMsg + "WORKSPACE\n=========\n";
    	strMsg = strMsg + "Drafts tagged with 'template': " + wsDrafts.length.toString() + "\n";
    	strMsg = strMsg + "\nDrafts in Workspace\n-------------------\n";
    	wsDrafts.map(wsDraft => strMsg = strMsg + "\n- " + wsDraft.title);
    
    	// Display results
    	alert(strMsg);

Options

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