Drafts Script Reference
    Preparing search index...

    Class SelectPrompt

    Select prompt allow the creation and display of custom dialogs which prompt the user to select from a list of options. The prompt is searchable to filter the list, and keyboard navigable. This is a great option if you need to make a selection from a long list of items.

    let p = new SelectPrompt()
    p.message = "Select from the options below" // optional

    p.addItem("id1", "First Item", "Optional subtitle")
    p.addItem("id2", "Second Item", "Optional subtitle")
    p.addItem("id3", "Third Item", "Optional subtitle")

    // if `show` returns false, user hit
    // cancel button
    if (p.show()) {
    let selectedID = p.selectedItem.id
    // do something with your selection
    }

    Display

    message?: string

    An optional explanatory message to display at the top of the prompt

    Items

    • Add an information text label to the prompt. Returns true if item successfully added. If item cannot be added, check action log of details of the error, typically it is because of issues like a duplicate id value, or missing parameters.

      Parameters

      • id: string

        Identifier. Should be unique to the items in the prompt.

      • title: string

        User-facing description.

      • Optionalsubtitle: string

        Optional additional explanatory text.

      • OptionalsymbolName: string

        Optional SF Symbol name to display as an icon.

      Returns boolean

    Other

    • Displays the prompt. Returns true if the user selected one of the item, false if cancelled without making a selection.

      Returns boolean

    Result

    selectedItem?: SelectPromptItem

    After the show() method is called, this property will contain the item the user selected in the prompt. If the user cancelled without making a selection, it will be null.