How to process a template on multiple drafts and combine into a single draft

You cannot change the target draft of the action.

You can:

  1. Pass text to subsequent action steps either via variables in the case of scripting, or using custom template tags for non-scripted action steps.
  2. Or, queue another action to run with the new draft as the target draft.

For 1:

In your script, call draft.setTemplateTag("new-draft-content", dNew.content), then you can use the [[new-draft-content]] tag in subsequent action steps to get that text.

For 2:

Setup your other action the way you want, and at the end of your script do:

let action = Action.find("MY-ACTION-NAME");
app.queueAction(action, dNew);

Then the other action will run with the new draft as the target immediately after the current action finishes.

1 Like