Create New Draft with Tag

Has anyone created an action that starts a new Draft with a specific tag? I’ve been searching, but maybe I’m using the wrong search terminology?

There are a couple of ways to do it.

In script, it would look like this:

let d = Draft.create();
d.addTag(“tag-name”);
d.update();
editor.load(d);

Or, you could do a URL action like:

drafts5://create?text=&tags=mytag 

I tried both and I’m not sure what I’m doing wrong. The URL method doesn’t actually add a tag, and the script gives me an error.

The URL has an issue in that the tag related parameter should be singular.

drafts5://create?text=&tag=mytag

The script one works fine for me, but when I copied it from the forum it had smart quotes that I had to swap out first. Here’s what worked for me.

https://actions.getdrafts.com/a/1QH

Hope that helps.

Oops. Thanks for pointing out the error.

Works great thank you. This is awesome