Specifying details for a script element

Use a Script step to execute a script from workflow.

You can use an approved script from ION Scripting which does not require input or output of type binary. In the step properties you can configure which script to start. Map workflow parameters or workflow structures as input to the script. Map script output variables to workflow parameters. At runtime, the script is executed within the workflow step synchronously.

At runtime, the workflow starts the script as configured and the latest approved version of the script is executed by ION Scripting. When the script is finished, the values of its output variables are returned to the workflow. These values are collected as specified in the Output Mapping.

This table shows the data type compatibility for input mappings:

Workflow data type Script data type Remarks
STRING

String

Applies to workflow parameters and to workflow structures that are serialized as JSON string.
INTEGER

Integer

BOOLEAN

Boolean

DECIMAL Number
DATE AND TIME String The date and time value from workflow is represented as string according to the ISO-8601 standard. For example: 1994-11-05T13:15:30Z.
DATE String The date value from workflow is represented as string according to the ISO-8601 standard. For example: 1994-11-05.
USER String The user’s identifier is represented as string. For example: 9136939c-e33b-4c5d-966d-506a17a276ff.
DISTRIBUTION GROUP String The group name is represented as string. For example: TestGroup.
CODE String The code value is passed as a string. Note that the code description is not included.
HYPERLINK String The hyperlink value is passed as a string.
Note: When a structure is serialized as JSON string, all its elements with name, data type and value are included. The labels and translations for the structure fields are not included. This is an example of a workflow structure represented as JSON string:
{"name":"OrderedItems","fields":[],"levels":[{"name":"Items","fields":[{"type":"STRING","name":"ItemDescription","value":"Wheel4090"},{"type":"DECIMAL","name":"Price","value":90.0},{"type":"INTEGER","name":"Quantity","value":4}],"levels":[{"name":"ProductionInformation","fields":[{"type":"DATE","name":"ManufacturingDate","value":"2015-10-22"},{"type":"STRING","name":"Site","value":"ESP"}],"levels":[]}]}]}

This table shows the data type compatibility for output mappings:

Script data type Workflow data type Remarks
String STRING If the string value returned from the script has more than 4000 characters, the string is truncated.
Boolean BOOLEAN
Integer INTEGER
Numeric DECIMAL
String DATE AND TIME If the string returned from the script cannot be parsed according to the ISO-8601 standard for date and time, an error is reported.
String DATE If the string returned from the script cannot be parsed according to the ISO-8601 standard for a date, an error is reported.
Note:  The Workflow parameters with these data types cannot be used in output mappings:
  • USER
  • DISTRIBUTION GROUP
  • CODE
  • HYPERLINK

In the Settings tab of the Script step you can configure if the workflow must continue or fail in case of a script execution error. When you select the The workflow continues option, you can collect the error response code and use it in the workflow.

This list shows the possible error response codes:

  • Code 400: An error occurred during the script execution.

  • Code -1: The workflow cannot reach the scripting service.

  • Code -2: There is an error in mapping the input variables.

  • Code -3: There is an error in mapping the output variables with values received from scripting.

In each of these error situations, the error message gives more information about the cause of the error.