Skip to main content

Script Target

The script target is a built-in automation target that runs a named ODSL script whenever an automation condition fires, passing in the triggered entity as context. It is the most flexible built-in target — any logic that can be written in ODSL can be executed in response to any platform event.

Built-in targets

Built-in targets are provided by OpenDataDSL and referenced using the @ prefix on their script name (e.g. @ScriptTarget). They are available to all tenants without any additional configuration.

Script target vs custom ODSL script target

The script target runs any ODSL script you specify at automation configuration time. If you want to hard-code the script and expose only specific inputs to the user, consider creating a Custom Target backed by your ODSL script instead.


script — Run a script​

Inputs​

InputRequiredTypeDescription
script✅script (ODSL)The name of the ODSL script to run

The script input is filtered to ODSL scripts only — mustache, Python, and other script types are not selectable.

Transformation is not supported for this target — any data shaping should be handled within the script itself.


Using this target in an automation​

Run a script when a dataset completes​

//#region Run a validation script when a dataset completes
ab = AutomationBuilder("dataset", "private", "MY_PROVIDER.FEED.PRODUCT")
ab.addCondition("complete")
ab.setTarget("script")
ab.setProperty("script", "my-scripts\\processing\\DatasetCompleteHandler")
ab.icon = "file-play text-office"
ab.enabled = true
save ${automation:ab}
//#endregion

Run a script when an object is updated​

//#region Run a recalculation script whenever a reference object changes
ab = AutomationBuilder("object", "private", "MY_REFERENCE_OBJECT")
ab.addCondition("update")
ab.setTarget("script")
ab.setProperty("script", "my-scripts\\calculations\\RecalculateDerivedData")
ab.icon = "file-play text-office"
ab.enabled = true
save ${automation:ab}
//#endregion

Accessing automation context in scripts​

The triggered entity is made available to the script at runtime. You can also access automation properties via #PROPERTIES if additional configuration has been passed through the automation:

GlobalDescription
#PROPERTIESThe properties object configured on the automation

Using a script target in a pipeline​

Because a script execution fires scriptlog service create actions on completion, you can chain further automations after a script run. This is useful when a script produces data that should then trigger a report, notification, or queue message.

dataset:complete  →  [script target]  →  Script runs  →  [email / queue / report target]

The example below runs a processing script on dataset completion, relying on the script's own logic to determine whether further downstream steps are needed:

//#region Run a post-processing script when a dataset completes
ab = AutomationBuilder("dataset", "private", "MY_PROVIDER.FEED.PRODUCT")
ab.addCondition("complete")
ab.setTarget("script")
ab.setProperty("script", "my-scripts\\processing\\PostProcessDataset")
ab.icon = "file-play text-office"
ab.enabled = true
save ${automation:ab}
//#endregion
When to use this target vs a process

Use the script target for lightweight, single-script responses to events. If your logic involves multiple steps, sequencing, retry handling, or needs to be scheduled independently as well as event-driven, consider using the Process Target instead.


Pre-configured script target​

If the same script is always run in response to a particular event, you can create a custom target with the script name pre-filled:

//#region Create a pre-configured target for a specific script
at = AutomationTarget()
at.publisher = "myorg"
at.code = "run-post-process"
at.name = "Run the post-processing script"
at.description = "Runs the standard post-processing script on dataset completion"
at.icon = "file-play text-office"
at.script = "@ScriptTarget"
at.template = "run the post-processing script"
at.allowTransformation = false
at.allowPropertyChange = true
at.services = ["dataset"]
at.actions = ["complete"]

at.properties.script = "my-scripts\\processing\\PostProcessDataset"

at.tags = ["Script"]
save at
//#endregion

Once saved, automations using run-post-process require no additional properties:

//#region Use the pre-configured script target
ab = AutomationBuilder("dataset", "private", "MY_PROVIDER.FEED.PRODUCT")
ab.addCondition("complete")
ab.setTarget("run-post-process")
ab.icon = "file-play text-office"
ab.enabled = true
save ${automation:ab}
//#endregion