[SOLVED] Complete draft content retrieved in Shortcut

I’d like for the “Get Contents of Draft” Shortcut action to retrieve the complete contents and in particular the coordinates.

That’s the old action bundled with Shortcuts - it’s referencing the draft by UUID.

According to the documentation, the Get Draft action should return a dictionary that Shortcuts can then then be queried for data like coordinates. However, when I’ve tried it myself, I don’t seem to get a dictionary as a result of the action.

Can anyone else get a dictionary back from the Get Draft action?

I’m seeing the same thing. If I try to get Shortcuts to read the Draft as a dictionary, I get a popup saying “Conversion Error: Get Dictonary Value failed because Shortcuts couldn’t convert from Draft to Dictionary.”

It seems the Draft object isn’t actually outputting a Dictionary. When you tap the “Draft” variable, you can choose one of the parameters listed in the documentation, but it looks like you have to set this manually for the action, and can’t have the Shortcut choose a parameter dynamically. Not sure why it’s set up this way.

You should not be getting a “Dictionary”, you should be getting a “Draft”. When you select the result of the “Get Draft” shortcut action, is it showing “as Draft”? It directly has all the properties of the draft available.

2 Likes

OK, this action give me all the data I need, but how I can get a draft having just its UUID?

I need to execute a Shortcut to manipulate the draft I’ve just edited in Drafts. Currently I’m sharing an url with the shortcut, extracting the UUID and trying to use it to retrieve se draft.

Am I using a wrong approach?!

Ok, I think I understand now. I was adding an unnecessary step by trying to have a separate dictionary within the shortcut instead of just having an action read a specific parameter straight from the Drafts object. Thanks, Greg! I’m still trying to wrap my head around all the new Shortcuts stuff. :sweat_smile:

@paolo_santucci, I’m not sure I understand what you’re asking. Are you trying to have the first step of the shortcut be to grab the draft you most recently had open? If so, you can start with the “Search Drafts” action, and use the sort order “Accessed” (or “Edited” if that’s what you want), then change the Maximum number of results to 1. That will grab the last draft you worked on, and you can run other actions on it from there. You can further tweak the search options to fit your use case but those should be the most important ones.

There is not a shortcut action to get a draft object directly via UUID right now. That is something I plan to add to avoid the need for the Search Drafts step @alexussery suggests, but his suggestion is the only way to do it right now.

Thank you both, @alexussery‘s solution solved my problem.

2 Likes

Thank you for this. I was about to put in a request for an update to “Get Contents of Draft” that didn’t go into Drafts when executing as a shortcut. This is even better!!!

1 Like