Drafts Script Reference
    Preparing search index...

    Class Action

    In addition to being able to lookup an action using the find method, a single global action object is created and available in scripts to inquire about the current action and control flow.

    Queuing an action to run

    // find action by name
    let otherAction = Action.find("Copy");

    // queue to action to run after the current action, on the same draft
    app.queueAction(otherAction, draft);

    Branching based on current action

    // use global `action` to branch logic in a script reused in multiple actions
    if (action.name == "Copy") {
    // do something
    }
    else {
    // do something else
    }
    Index

    Configuration

    Identification

    Query

    Configuration

    configuredValues: [string: any]

    If this action has "Configured Value" action steps and the user has configured values for the action, this object will contain those values. Primarily of use to load configuration values from a different action than is currently running.

    Identification

    installURL: string

    URL which can be used to install this Action in another installation of Drafts. Useful for sharing and backups.

    isSeparator: boolean

    If true, the action is a separator.

    name: string

    The display name of the action as displayed in the action list.

    uuid: string

    The unique identifier of the action group.

    Query

    • Search for action matching the name passed and return it if found. Useful to lookup and action and queue it to be run using the App.queueAction function of the App object. This method will return only the first found action with the given name, be sure to avoid duplicate names in your action list.

      Parameters

      • name: string

        Name of a valid, installed action.

      Returns Action