Getting result from Shortcuts action "Run Action with Text"

I have a shortcut that ends in an array:

["item 1","item 2", "item 3"]

My shortcut calls a Drafts action which runs this script:

let items = draft.processTemplate("[[shortcut_result]]")       
console.log(items)

In the console, I get this result “[[shortcut_result]]”

What am I doing wrong?

[[shortcut_result]] is only applicable if you are calling the shortcut from Drafts, using the “Run Shortcut” action step…in which case you would not be calling back into Drafts from Shortcuts to run an action.

If you want to start in Shortcuts and pass data to drafts, you would have to pass that array as a string value in the text passed to Drafts in the shortcut, and the action would have to parse it back into an array value.

Does that make sense?

Thanks for the support today!

I’m not clear on this part. How do I parse the text passed to drafts?

ok, I solved it. You gave the answer here:

1 Like