Draft Action via Shortcuts

I’m trying to create a Shortcut that accepts text as an input, creates a new draft with that text, and then runs a draft action on the draft that was just created. I think I have all the steps down, but I can’t get the draft action to run on the draft I just created. Instead it runs on a new draft. I’ve tried getting the UUID of the created draft and pass it on. I am doing something terribly stupid. Any suggestions?
(FYI, the Draft Action takes the text of the draft and numbers the lines.)

I know there was a similar topic here a few days ago, but i haven’t figured out how that solve might apply to me.

That basic flow seems to work for me here…the “Get Draft” step is not necessary, as the “Create Draft” step also returns the Draft object it created - but either version worked in my tests.

How, exactly, is it not working? The Run Action step should launch Drafts and you should get a normal confirmation banner or whatever if the action ran.

Also, what does the “Number Lines” action do? Is it a script that does something? If so, is that script written to manipulate the editor object, not the draft? Because that would not work because the draft would to not necessarily be loaded in the editor. If you need that draft to be loaded, you can add an “Open Draft” step before the “Run Action” step.

1 Like

Yup, that did it. I needed to “Open Draft” in shortcuts, as the script takes the content of the draft and turns it into a numbered list. (I’m sure I could perform this same action in the shortcut itself, but I already have it working in Drafts.

It’s a little counterintuitive, as the shortcut launches Draft with my new draft, before the Action has been run, and I have to jump back to the original source app, at which time I’m bounced back to Drafts with the action applied. But it totally works!

1 Like