The [Script-task] process element is a system action that executes the C# code and provides its interaction with other elements of the business-process. Use this element to implement logic that the standard process elements cannot provide.
To edit the script code, double-click the diagram. Element setup page will open, where you can enter and edit the script code (Fig. 37).
– expand the script code window.
– collapse the script code window.
– search text in the script code.
– show the hidden symbols (spaces, tabulations, etc.) in the text code.
Note
Bpm'online enables you to execute processes without publishing them. However, the use of methods and [Script-task] elements requires the schema publication. Learn more about calling process methods in a separate article.
The [Script-task] element and the process method contain an additional cheсkbox [For an interpreted process], which indicates that the element can be executed in an interpreted environment (Fig. 38). By default, this checkbox is selected. For such elements and methods a special code is generated that provides an interface to access the element and process parameters and values.
Interpreted process schemas
For the [Script-task] elements and methods that have the [For an interpreted process] checkbox selected, the wrapper class is generated that contains the initialization and declaration of methods. This wrapper enables you to access the process values (Fig. 39).
The Get method returns the value of an item or process.
Method signature:
Get<T>(string path)
where:
T — parameter value type.
path — a string that specifies the path to a parameter or property. The path is built according to these rules:
•“parameter name”
•“property name”
•“element name.parameter name”
•“element name.property name”
The Set method sets the value of an item or process.
Method signature:
Set(string path, T value)
where:
value — the specified value.
path — a string that specifies the path to a parameter or property. The path is built according to the rules described above for the Get method:
Next
•[Connect process to object] process element
See also
•An example of using the built-in object process. How to add auto-numbering to the edit page field