Script Activity
- Last UpdatedSep 16, 2025
- 4 minute read
Activity Description:
The Script Activity enables execution of scripts written in C#. When included in a workflow, the activity calls the Run method in the script. Assembly references are taken from the activity properties. The string value returned from the Run method is assigned to the Output parameter. The Script Activity then executes the script, and the workflow continues along the link that matches the returned value.
Note: The Script activity does not support VBScript.Net or JScript.Net.
Features of Script activity
-
Compilation of the script code is made at design time to enable discovery of syntax or other errors during design.
-
Loading all scripts defined through script activities as a single assembly. All script activities are compiled as a single assembly and only one assembly is loaded during workflow execution. This significantly improves performance.
-
When a workflow is published, the script details are stored in the SWScriptCode table to enable identification of source code and assembly references.
Activity Properties:
The Script activity has to be configured by specifying appropriate values for the different properties in the Activity Properties area. The Activity Properties can be accessed by clicking on the Activity Properties tool in the Tool Bar or by selecting the appropriate option from the right click menu for the Script activity. The Activity Properties are organized under the following groups of related properties. The properties under each group are described in this topic.
The following image shows the Script Activity Properties window:
Name & Description
The properties in the Name & Description group have been described below. You can use these properties to specify the name and description for the activity.
The following image shows the Name & Description properties of Script Activity:
Name - This property can be used to specify a name for the activity.
Property Type: Optional (This property needs to be set only if necessary.)
Description - This property specifies a brief description to be displayed for the activity.
Property Type: Optional (This property needs to be set only if necessary.)
Programming
The properties in the Programming group have been described below. You can use these properties to program the script activity.
The following image shows the Programming Properties of the Script Activity:
Language - This property specifies the language of the script to be run. This property can be set to 'C#.NET' depending on the scripting language required.
Property Type: Mandatory (This property must be set if the action is to be executed.)
Code - This property specifies the code of the script to be run.
Property Type: Mandatory (This property must be set if the action is to be executed.)
Steps to set the Code property
-
To enter the code, click on the button for the 'Code' property to open the property window.
-
In this window enter the code directly in the text editor.
-
If you want to assign the code dynamically during run-time, you can do so using the Field controls. For example, you can add a variable or content pointing to the code from the two drop downs for Field and click on the Append button. This will add the placeholder for the variable or content in the text editor. At run-time this placeholder will be replaced by the corresponding value, i.e. the code.
-
You can manipulate the text using the appropriate tools from the tool bar. You can cut, copy and paste text, undo and redo changes, zoom in and zoom out the view as well as print the text.
-
You can format the text, if necessary, using the formatting tools. You can make text bold or italic or change the font or size, set text color or background color.
-
After adding the code, click the Update button to save it
-
Click the Close button to close the window without saving the code.
See Script - Code for a detailed description of the Code property window.
Reference - This property specifies the global objects that can be referenced in the script.
Property Type: Mandatory (This property must be set if the action is to be executed.)
Steps to set the References property
-
To specify the References, click on the button for the 'References' property to open the property window
-
In this window, enter the reference object in the References field
-
Next, enter the corresponding assembly path in the Assembly Path field
-
After entering the return value details, click the Add Row button to add this reference and display a new row for entering another reference
-
Remove rows if necessary by selecting them and clicking the Remove Selected button
-
After specifying the references, click the Update button.
See Script - References for a detailed description of the References property window.
Output Values
The properties in the Output Values group have been described below. You can use these properties to specify the output values for the activity.
The following image shows the Output Values Properties of the Script Activity:
Return Values - This property allows the user to specify the return values for this action. These values become the conditions for the workflow engine to pick up the next action to execute.
Property Type: Mandatory (This property must be set if the action is to be executed.)
Steps to set the Return Values property
-
To specify the Return Values, click on the button for the 'Return Values' property to open the property window
-
In this window, enter the return value in the Return Values field
-
After entering the return value details, click the Add Row button to add this return value and display a new row for entering another return value
-
Remove rows if necessary by selecting them and clicking the Remove Selected button
-
After specifying all the return values, click the Update button.
See Script: Return Values for a detailed description of the Return Values property window.
Action outputs:
The Script Action does not have any standard return value. It will output the value specified by the user in the Return Values property.
Exception Behavior
Each activity has the Raise Error on Unhandled Linked Output property on click of which, it shows all the default configured mapped error outputs in red with their check boxes selected.
See Mapped Error Outputs for more details.