In Drafts 14/ios12 I had a Drafts action that takes the contents of a draft, sends it to Shortcuts which queries for some JSON, dictionary results populate a form, and then it updates the original Draft with the new form. For this, I used the method Greg describes here.
As I’m updating it for Drafts 15/iOS 13, it seems it would be easiest to do it all in Shortcuts, w/o a “wait for results” in Drafts. The problem is that the “Update Drafts” action in shortcuts won’t seem to take a UUID (or a magic variable with a UUID) as input. Rather — I have to choose a specific Draft from a picker.
The obvious work-around is use the old method (or a hybrid), but I think it would be powerful if you can send a UUID to Shortcuts, do some stuff, and use Update Draft on that UUID. (Unless there’s some security or other limitation I’m missing here).
Let me know if I’m missing anything or if anyone has a more elegant solution.
Run Shortcut step has a template. By default, it sends the drafts content to Shortcuts with the
You could send the
[[uuid]] instead, then “Get Draft” in Shortcuts. If that heads you in the right direction.
Thanks for chiming in Greg, I think my first message was unclear.
I already did what you suggested (sent
[[uuid]] to Shortcuts and used
Get Draft in Shortcuts). However, at the end of the Shortcut, at first I tried to
Update Draft using the same UUID variable and couldn’t find a way to do it.
It works fine by setting the Drafts Shortcut Action to
wait for response, exiting the Shortcut with Text, and using that text to update the draft in a second action step in Drafts, as described in the original link which inspired the action in the first place (Thank you!).
But it got me wondering about what can be done in Shortcuts with multiple drafts, or updating the same draft multiple times, by giving
Update Draft an
UUID in variable form.
So nothing broken, just an edge-case feature which might unlock some power (or unlock possible disasters in the relatively poorly documented Shortcuts world).
I’ve been working some similar workflows between Shortcuts and Drafts. When I’ve needed to update a draft, I use the Update Draft Action in Shortcuts and select the Replace option instead of Append/Prepend. I reference the original draft by the title, which I think is the first line of content that you would have grabbed earlier in the shortcut. I do the text-wrangling (separating title from body, adjusting body text, recombining) in shortcuts and then use Update Draft to send it back. Hope this helps.
If you are using an action in Shortcuts that asks for a UUID, it is a deprecated URL-based action. Apple will likely remove those soon.
Update Draft actions need to target a “Draft” object, not a UUID…which you would get as the variable returned from a
That said, I would not think it’s generally a good design to have more than one call to
Update Draft for the same draft in the same shortcut. Should work, but whatever your processing you are doing could be handled in a variable in Shortcuts, then the draft updated once.
Not sure if I understood or not, but is that helpful?
Very helpful — thank you!