8.1
Table Of Contents
Script Contents dialog box
• Select Function: If you want to execute a single function, check this box and enter the
function name (without parameters) in the corresponding field.
• Parameter Value list: The rows in this list correspond to the parameters of the selected
function. The first row corresponds to the functions first parameter, the second row to the
function's second parameter, and so forth. To add a row, click +. To pass a the trigger asset
to a parameter, choose Trigger Asset from the drop-down menu for that row. To pass a
literal value to a parameter, choose Other from the drop-down menu for that row and
then double-click in the corresponding field to the right and enter the value.
If you plan to use the trigger asset, a template, or some other file or asset as a parameter
value for a script, you must make sure the script has been set up to handle that file or asset.
To do so, load the "ScriptWorkflowUtil.js" script and use its createFilePathContainer()
method. For example, if you wanted to write a simple script that writes the name of the
trigger asset to the console, it might look like this:
load("AutomationServicesUtil");
...
function displayFileName(filePathParam)
{
// Create a filePathContainer from the file path parameter
var filePathContainer = createFilePathContainer(filePathParam);
if (filePathContainer.assetId != null) {
// Get the file name and write it to the console
var assetName = getAssetName(filePathContainer.assetId);
print(assetName);
}
}
The createFilePathContainer function (supplied in the "AutomationServicesUtil.js" script)
takes a file reference that has been passed from Automation Server and converts it to a
filePathContainer object. You can then access the path to the asset with
filePathContainer.filePath and get the ID of the asset with
filePathContainer.assetId.
12 | AUTOMATION SERVICES 8.1 WORKFLOW REFERENCE
WORKFLOWS