Script Constructs Window

Use the Script Constructs window to enter C# code to create custom methods contained within the Script component. An example of a completed Script Constructs window is shown at the end of this topic. Here is a description of the Script Constructs window:

Function

Description

Methods

Lists all of the methods contained in this script component. When the Script Constructs window is first opened, the list is blank. Click the Add Method button to create the first method.

Add Method

Adds a method to the script.

Delete Method

Deletes the method currently shown in the Methods box.

Print Method

Prints the method currently shown in the Methods box.

Save Method

Saves the method currently shown in the Methods box.

Language

Sets the coding language (C#) used for all methods contained in this script.

Using/Imports

The Using/Imports area lets you enter using directives for any referenced types to be used in the methods for this script. You must first add the assembly/assemblies you intend to use by completing the script's References property (in the Design Properties window). For more information, see Script. Any referenced types must also be added to the References folder in Solution Explorer for the project. For more information, see Using Project References.

Name

Name of the method. The default for new method is Execute1. Method names can include spaces.

Parameters

Type and name of all input parameters for the method. When entering multiple parameters, separate the parameters using a comma. Here is an example: string Fname, string Lname, Int account.

Result Type

The value type of the method result. Note that a Script method can have only one output result.

Include

Check this box to compile the method as part of the script object code. The default is checked, which requires that the method passes validation to be saved and included in the script. Clear the Include check box when you want to retain the method in the script but the method code...

  • Is incomplete

  • Does not pass validation

In these cases, you could close the Script Constructs dialog without losing the incomplete/invalid methods.

Hide

Check this box to disable the method from appearing in Object Inspector when the Script component methods are viewed.

Method body

This is the method code.

Validate

Click this button to validate the method code. If the method contains errors and you try to exit the Script Constructs window without clearing the errors, Studio warns you that the script blocks will be removed. If you continue, the method will not appear in the Object Inspector for the script.

OK

Click OK to close the Script Constructs window. You are prompted to save any unsaved methods.

Cancel

Click Cancel to close the Script Constructs window without compiling newly-added methods or modified methods. The new methods or changes will not appear the next time you open the Script Constructs window for the script.

 

 


Privacy | Trademarks | Terms of Use | Feedback

Updated: 18 June 2020

© 2016 - 2020 Pegasystems Inc.  Cambridge, MA All rights reserved.

 

OpenSpan data classification label