I’m sort of new to scripting here, and have found some useful starting points. However, I’ve run into a block (although I’m sure it’s blindingly obvious with a little bit of knowledge)…
I have a list of projects stored in an archived draft. I am reading this list in to create a select list prompt using the “Script” action. My script is:
// get the real UUID value from (i) info for your draft with the list
let d = Draft.find("FCEAA5F4-0B02-48F5-AB57-136505A8BDA5");
// split the draft into an array of lines...
let list = d.content.split("\n");
var selections = []
// now you can loop over the lines to add to your prompt...
for (let item of list) {
selections.push(item)
}
var p = Prompt.create();
p.title = "Project";
p.message = "Select a project"
p.addSelect("project", "Project", selections, [], false)
p.addButton("OK");
var selection = p.show()
draft.setTemplateTag("project",selection)
draft.update()
My problem is that I cannot seem to get the value that the user selects from the list. At present my draft.setTemplateTag("project",selection)
returns TRUE (since something was selected). But, for the life of me, I cannot seem to access the value of what was selected.
Can anyone point me to where I can get the value so I can create the templateTag?
Many thanks