PowerShell

The Script action allows you to place custom code into the list of actions, this code can read and set any of the variables associated with the document and create new ones.

A minimal PowerShell script would just be a value that gets echoed to the log, for instance:

"Hello World"

will send the text Hello World to the log.

Use the $context object to create and access variables for use in other actions, for example to replace spaces with underscores in the DocumentName variable:

$name = $context.GetValue("DocumentName")
$name = $name.Replace(" ", "_")
$context.SetValue("DocumentName", $name)

Any variables you set using $context.SetValue are available in templates in subsequent actions.

This action replaces the now obsolete Script action, any Script actions with the language set to PowerShell are automatically converted to PowerShell actions.