Get the content of the current draft?

I must have a blank, but I try to get the content of the current draft and can’t get it to work. In a Script action step I use:

var c = app.draft.content
alert(c)

but I get the error “_ undefined is not an object (evaluating ‘app.draft.content’) _” on this.

What do I do wrong? I thought app is a global object and draft is an object property of it…

Just draft.content should serve you here.

https://scripting.getdrafts.com/classes/draft

1 Like

Cool. Perfect. But where in the doco says it that the global variable draft exists?

The global draft variable is in the docs with other global declarations.

1 Like