Today's Drafts to New Draft

Posted by sylumer, Last update about 1 year ago - Unlisted


  • script

    function mergeDraftsToday(p_Separator = "\n")
    	// Create a new workspace object
    	// We are not going to save this, just use it to get today's drafts
    	let wsToday = Workspace.create();
    	// Build a query date for drafts created today
    	let qdStart = new QueryDate();
    	qdStart.field = "created";
    	qdStart.type = "absolute"; =;
    	// Assign the query date to the workspace
    	wsToday.startDate = qdStart;
    	// Get an array of drafts from the inbox for the 'today' workspace
    	let adToday = wsToday.query("inbox");
    	// Create an empty array and populate it with the content of today's drafts
    	// Each draft's content becomes a separate element in the array
    	let astrOutput = []; => astrOutput.push(dToday.content))
    	// Create a new draft from the array of draft content
    	// The drafts are concatenatd using a separator string passed into the function
    	let dNew = Draft.create();
    	dNew.content = astrOutput.join(p_Separator);
    	// Load the new draft and activate the editor
    // Merge today's drafts into a new draft with two newline characters between each of the drafts' content


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