Wanting to create a single action with multiple template tags …

I’m wanting to create multiple template tags in a singular action, is this possible.

For Example:

Defined Template Tag: [[tagOne]] / This is tag one.
Defined Template Tag: [[tagTwo]] / This is tag two.
Defined Template Tag: [[tagThree]] / This is tag three.

Insert Text: looking to be able to insert one of the above defined template tags via prompt selection … and I assume the easiest way of doing this would be by a script?

I appreciate any feed back or response, thanks in advance!

That would look something like this, where this script is between your “Define Template Tag” steps and your “Insert Text” step:

// Assumes three define templates precede this script

// create prompt with three buttons
let p = new Prompt()
p.title = "Select Option"
p.addButton("1")
p.addButton("2")
p.addButton("3")

// display the prompt
if (p.show()) {
	// create var to hold value
	let newTag = ""
	// get the button pressed in the prompt, and retreive appropriate template tag
	let b = p.buttonPressed
	if (b == "1") {
		newTag = draft.processTemplate("[[tagOne]]")
	}
	else if (b == "2") {
		newTag = draft.processTemplate("[[tagTwo]]")	
	}
	else if (b == "3") {
		newTag = draft.processTemplate("[[tagThree]]")
	}
	// create a new template tag with the right value
	draft.setTemplateTag("newTag", newTag);
}
else {
	context.cancel() // user hit cancel button
}

// Use [[newTag]] in your "Insert Text" step after this script.
1 Like

Note that this also sounds like the kind of thing that might be handled well by autocomplete, without the need for an action.

1 Like

This is perfect, thanks you so much! I really appreciate it. Hopefully someone else will also find it useful.