The Draft object represents a single draft. When an action is run, the current draft is available as the global variable
draft. Scripts can also create new drafts, access and set values, and update the draft to persist changes.
// create a new draft, assign content and save it let d = Draft.create(); d.content = "My new draft"; d.update();
// query a list of drafts in the inbox with the tag "blue" let drafts = Draft.query("", "inbox", ["blue"])
The full text content of the draft.
Is the draft current in the archive. If
false, the draft is in the inbox.
Current flagged status.
Is the draft currently in the trash.
The preferred language grammar (syntax) to use for the draft. Can be any valid installed language grammar.
URL which can be used to open the draft.
The length of the last text selection.
The index location in the string of the beginning of the last text selection.
Array of string tag names assigned to the draft.
The title. This is generally the first line of the draft.
Unique identifier for the draft.
Assign a tag
Get the current value of a custom template tag.
Check whether a tag is currently assigned to the draft.
Runs the template string through the template engine to evaluate tags (like
Remove a tag if it is assigned to the draft.
Set a custom template tag value for use in templates. For example, calling
setTemplateTag("mytag", "mytext") will create a tag
[[mytag]], which subsequent action steps in the same action can use in their templates.
Save changes made to the draft to the database. This must be called to save changes made during an action’s execution.
Create a new draft object. This is an in-memory object only, unless "update()" is called to save the draft.
Find an existing draft based on UUID.
Perform a search for drafts and return an array of matching draft objects.
Search string, as you would type in the search box in the draft list. Will find only drafts with a matching string in their contents. Use empty string (
"") not to filter.
Filter by one of the allowed values
Results will only include drafts with one or more of these tags assigned.
Results will omit drafts with any of these tags assigned.
true, sort descending. Defaults to
true, sort flagged drafts to beginning. Defaults to
Return array of recently used tags. Helpful for building prompts to select tags.
Generated using TypeDoc