2Qs: Draft.query / Move to archive

Two questions here today:

  1. Trying to use Draft.query(queryString, filter, tags, omitTags, sort, sortDescending) and sort by modified - using the following:

var drafts = Draft.query("", "archive", "tagname","","modified")

Was hoping I could pull all drafts in the archive with tagname sorted by modified date (newest would be the top) - transforming these into button titles. Getting a “Script Error: TypeError: Cannot convert primitive to NSArray”. What am I missing here?

  1. Move draft I am working on to archive - can’t seem to figure out how to do something like:

    d.archive(); //know this is incorrect…
    d.update():

Anyone have an example of Javascript for move to archive?

Thanks!

Your tags and omitTag arguments need to be arrays but you have strings.

So:

var drafts = Draft.query("", "archive", ["tagname"],[""],"modified")

To put draft d in the Archive, do this:

d.isArchived = true;
d.update();

Typing something I have never typed before - thanks to the Doctor and the Rooster! Script works like a charm now. Appreciate the help.