Flexible Packing List

Posted by @nahumck, Last update 19 days ago - Unlisted


19 days ago

Changed the action name from “variable” to “flexible”.

show all updates...

19 days ago

Changed the action name from “variable” to “flexible”.

26 days ago

One last fix to add some text for export.

26 days ago

Refactored the collection of Drafts content. (Thanks Greg for the assist!)

26 days ago

Fixed a syntax errors for the trip name and added the trip name to the subsequent checklist prompt step.

Create a flexible packing list by selecting one or more categories (queries drafts with the packing tag). Processes the selected categories into a single packing list and creates a new draft. Optionally send to Reminders as a task.


  • script

    /*--- Create Trip Name Prompt ---*/
    // Trip Name Prompt
    var p = Prompt.create()
      p.title = "Enter List Name"
      p.addTextField("tripName", "Trip Name", "", {"placeholder":"Enter List Name","autocapitalization":"words","wantsFocus":true})
    // Create variable for later use
    var tripTitle = p.fieldValues["tripName"]
  • script

    /*--- Create Checklist Prompt ---*/
    // Query all drafts with tag `packing` to get category titles
    // get your category drafts
    let catTitles = []
    let drafts = Draft.query("","archive", ["packing"])
    // map them to a lookup object
    let lookup = {}
    for (let t of drafts) {
    let dTitle = t.displayTitle
    lookup[dTitle] = t
    // Checlist Prompt
    var p = Prompt.create()
    p.title = "Select Categories for "+tripTitle
    p.message = "Select one or more categories to add to your list."
    // change [] to catTitles
    p.addButton("Create Packing List")
    var success =
    var selected = p.fieldValues["categories"]
  • script

    /*--- Compile ---*/
    // Combine selected drafts together into a single draft
    if (success) {
    	let packingList = "# "+tripTitle+"Packing List \n"
    	for (let sel of selected) {
    	// Pull draft from lookup table
    	let found = lookup[sel];
    	// Pull content from draft 
    	var content = found.content
    	// Combine selected draft content
    	packingList = packingList+"\n"+content
    	let d = new Draft()
    	d.content = packingList
    	var url = d.permalink
    else {
  • script (disabled)

    //Create Task in Reminders
    var list = ReminderList.findOrCreate("Inbox")
    var reminder = list.createReminder();
    reminder.title = tripTitle;
    reminder.url = url;
    reminder.notes = url;


  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.