Pass value between actions

Hello, I have a few actions that pass values between them, but I haven’t found a way in the documentation to do it, so I just write the data at the top of the document and delete it afterwards.

Wanted to know I’f there’s another way of doing that. Thanks

1 Like
  1. Are you chaining the actions together automatically or manually?
  2. Do the actions always follow on from one another, or are they independent actions that you happen to run in sequence and optionally may need to utilise persisting data.
  3. Can you provide an example to give some context to what your scenario is? E.g. What are two actions that run sequentially, and what is the data that is handed on?

I am chaining them automatically, I currently only have 2 (because of the hassle of coding the passing values).


In my drafts to organize my various drafts about the same project I link them by their UUID and by tags, to be able to preview many drafts at once.

# Script for project X

Paragraph number 1

UUID: [[uuid]] (# Important topics to hit)

Paragraph number 2

To make the link I have an action that asks me if I want to select an existing draft or create a new one. And in case is a new one it asks me for a different action that creates drafts from a template.

What I pass through

From that I’m passing through the project name, some extra tags and any selected text I had. Witch I’m writing at the first line and deleting at the end of the actions

Still not clear on the use case - how are you “chaining” actions?

Regardless, some general comments:

  • Each action executes in it’s own context. Scripted global variables will be available across multiple script steps in the same action.
  • Data can be passed between scripted steps and other types of steps which use templates using draft.setTemplateTag.
  • The Include Action action step can be used to embed steps from another action in the current context as if they were defined there - so if you are “chaining” to reuse scripts or other action steps, you might consider this as a better strategy so those variables are shared.
  • The other reliable way to store and restore values is to write and read values from files using FileManager functions.

I’m basically chaining 2 independent actions together sometimes, not always, and I want to give some information to the second action but


Does not work, so what I do is write the information on top and delete it after I’m done.

Just wanted to know if there was a way to do it other that my solution.

Thanks, hope that’s enough explanation

You haven’t described yet how you automatically chain the actions together. How you do it can affect what approaches you can take.

Are you automatically chaining via an Include Action action step, a URL call with the action parameter, using App.queueAction() in a script action step, or something else, like using Shortcuts to control the flow?

Sorry, my bad, I chain them together using the


But I can change the chaining to anything if it makes it posible

Okay, because the actions are ‘queued’ to run one after the other, they won’t be in the same context; as described in Greg’s notes above.

Options to consider would be.

  1. Change the method to something like include action, but you potentially lose any conditional branches doing that. But if you had two actions for two options and you knew which one to use at the start, this could work.
  2. Similarly you could simply build separate actions, but you then lose reuse of actions, but if everything were script-based and loaded form file, then you could regain that.
  3. Store your data somewhere that provides persistent storage between actions so that actions running in different contexts can share the data. Options could be:
    i. In the current Draft - just like you are doing, so no change, but you must ensure you are not switching drafts between actions; which presumably to this point you haven’t.
    ii. In a file in the file system - Greg references how to do this above.
    iii. In the clipboard - probably the easiest way, but you do lose whatever was previously on the clipboard.
  4. It might be that in some cases you could manipulate the draft content outside of Drafts using some sort of platform automation Shortcuts, or AppleScript (a work in progress) for example. These automation environments in turn have their own capabilities for providing data persistence.

Some methods are obviously more effort to implement, but hopefully, this summarises a set of approaches.

1 Like

Hi, thanks, I guess the best case would be multiple actions, I would like to use shortcuts, but I’m using the iPad Air first gen so it’s just too slow.

But thanks everyone

And it looks like the latest i*OS beta that was just released has some nice JSON related functions that potentially simplify things a little further.

1 Like