--- alias: user-guide-automation-business-scenarios-building-structure-step-script tags: - automation - connect iot description: "Executes scripts within a system, offering advanced functionality for data manipulation and actions" --- # Script Executes a script. This step is helpful to retrieve information, perform transformations or execute actions in the system. This step requires more advanced knowledge from the scenario builder. | Name | Description | Mandatory | Type | Possible Values | Default Value | | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------------------- | --------------- | ------------- | | script | Script to execute. When a string, it is expected to be encoded in Base64. When a string array, it is expected to be the code, one line per position of the array | Y | `String`, `String[]` | | | ## Available Scope | Property | Description | Type | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | answers | List of all answers provided by the user so far. The script has full access to the list, allowing it to read, change, add or remove answers | `Object` | | stepDefinition | Representation of the step where the script is executing. Cannot be changed. | [[user-guide-automation-business-scenarios-building-structure-step|BusinessScenarioStep]] | | lboUtilities | A set of utilities available to use to manipulate or invoke the light business objects. | [LBOUtilities](script-scopes/lboutilities.md) | | iotUtilities | A set of utilities available to use to manipulate or invoke the light business objects. | [IoTUtilities](script-scopes/iotutilities.md) | | masterdataDirector | A set of utilities available to use to create masterdata objects. | [MasterDataDirector](script-scopes/masterdatadirector.md) | | workflowBuilder | A set of utilities available to use to create workflow objects. | [WorkflowBuilder](script-scopes/workflowbuilder.md) | !!! info Information for the scope types for this step is available from the navigation menu on the left. ## Example snippets ```json { "type": "Script", "settings": { "script": [ "console.log('Hello World');", "// Dump all previous answers", "console.log(this.answers);", "this.answers.newAnswer = 'new Value';", ] }, "next": "NextStep" } ``` ```json { "type": "Script", "settings": { "script": "Y29uc29sZS5sb2coJ0hlbGxvIFdvcmxkJyk7Ci8vIER1bXAgYWxsIHByZXZpb3VzIGFuc3dlcnMKY29uc29sZS5sb2codGhpcy5hbnN3ZXJzKTsKdGhpcy5hbnN3ZXJzLm5ld0Fuc3dlciA9ICduZXcgVmFsdWUnOw==" }, "next": "NextStep" } ```