Help ELMA BPM Platform
×
Menu

Script Editor


Script Editor is used to write scripts in С#.
Script Editor features special tools for writing scripts, such as syntax highlighting, IntelliSense code-completion technology for functions and variables, links to assemblies and web services. These tools facilitate writing scripts and help to avoid syntax mistakes.
Once the script is written, you can check it for syntax errors and check the script semantics.
The Script Editor features a work pane and a side Settings panel.

Work pane

The work pane is for writing the C# code.
Note
Starting with ELMA 3.8.6 , the script editor in ELMA Designer shows a notification (for new scripts) with important information on working with scripts (fig. 1).
The type of the returned value and the list of variables depend on the operation, for which you create the script. In the following example, the context variable is sent to the script. It contains information about the context of the current process. The IntelliSense auto-complete technology allows you to view a list of supported methods and variable parameters (Fig. 1).
Fig. 1. Creating a script in Script Editor. List of methods and parameters of the context variable
Depending on the activity, for which you create a script, the type of returned value and the list of variables passed to the script may change. In this example, a context variable that contains the information on the current process context is passed to the script. With the IntelliSense auto-complete technology you can view the list of supported methods and parameters (fig. 2).
Fig. 2. Creating a script with the script editor. List of methods and parameters of the "context" variable
When you edit the process script module, do not change the title of the name space and the script module. If these values are modified, the process will have no access to the module's scripts.
In our example (Fig. 3) the name space is EleWise.ELMA.Model.Scripts, and the script module title is P_Request_Scripts. It is an extension of the EleWise.ELMA.Workflow.Scripts.ProcessScriptBase base class. All modules have the same title of the namespace and base class. The title of the script module is the same as the class name specified in process settings.
Fig. 3. Example of contents of the Script Editor's window
In addition, you can use the context menu in the script editor. To open it, right-click on the work pane. The context menu allows you to:
 
Copy – copy the selected code fragment to the clipboard.
Paste – paste the copied code fragment to the selected place.
Cut – copy the selected code fragment to the clipboard and delete it from the work pane.
Comment out – comment out the selected code fragment. The commented fragments are not checked and not executed.
Format edited text - format the selected code fragment. Note, that code formatting is unavailable if there are syntax errors.
Format document - format the entire code in the work pane. Note, that code formatting is unavailable if there are syntax errors.
The following hot keys are available in the script editor:
Hot key
Action
Ctrl + A
Select the entire code in the work pane.
Ctrl + C
Copy the selected code fragment to the clipboard.
Ctrl + V
Paste the copied code fragment to the selected place.
Ctrl + X
Copy the selected code fragment to the clipboard and delete it from the work pane.
Ctrl + G
Jump to a code line. When you use this combination, a dialog box for selecting a line opens (fig. 4).
 
Fig. 4. Go to line dialog box
In this dialog box, enter the required line number and click OK or press Enter. This dialog box will close and the cursor will move to the end of the selected line.
Ctrl + F
Quick search in the code. When you use this combination, a search form opens (fig. 5).
Fig. 5. Quick search form
Enter a word/phrase you need to find. As you enter, the matching words/phrases will be automatically highlighted green. If no matches are found, a respective notification will be displayed under the search string.
After searching, you can view the results. For this, use the   buttons, to the right of the search string or the Shift + F3/F4 keys. The current result is highlighted blue.
If you need to specify additional search parameters, click and check the boxes next to the required ones.
To close the search form, click .
Ctrl + K
Comment the selected code fragment. The content of commented code fragments is not checked and not executed.
Ctrl + S
Save the current script version. This key combination does the same as clicking Save in the toolbar (the current business process will be saved).
Ctrl + I
Automatically format the selected code fragment.
Note, that code formatting is unavailable if there are syntax errors.
Ctrl + Shift + I
Automatically format the entire code in the work pane.
Note, that code formatting is unavailable if there are syntax errors.
Alt + PageUp and Alt + PageDown
Jump to the nearest syntax error.
Ctrl + Shift + Space
Open a tooltip on method parameters and overloads.
Ctrl + Space
Open the command auto-complete pop-up.

Settings toolbar

The Settings section is located on the right-hand side of the Script Editor tab. It features links to web services and assemblies used in scripts. Assemblies and web services offer sets of methods that can be used in scripts. To use an assembly or a web service, first add them to the toolbar. To do so, click Add at the top of the settings panel (Fig. 6) or use the context menu (Fig. 7). To open the context menu, right-click in the list of links and to assemblies and web services.
Fig. 6. Settings panel. Add button.
Fig. 7. Context menu of the Settings panel
We recommend you to delete the unused links to assemblies and web services that were added manually. To delete an unused link, select it in the Settings section and click Delete either on the panel or the element's context menu.

Adding links to web services

To add a link to a web service, go to the Settings panel and click Add. Then select Add a link to the web service option (Fig. 6) or open the context menu of the settings panel and click Add a link to the web service (Fig. 7).
In the provided window, in the address bar at the top, enter the link to the WDSL file, which provides a description of the web service. Then click Go To. If the file is read successfully, the list of available services and methods will be displayed and ELMA will automatically fill in the Namespace field (Fig. 8).
Fig. 8. Adding a web service. Web Browser tab
To add a web reference instead of a service, click Add a web-reference… .
In the opened window (fig. 9) enter a link to a service description file (WSDL file) and click Go to. If the file is successfully read, the system will automatically fill in the Namespace field and the Web Browser tab (fig. 9). Code that uses the .NET.Framework 2.0 web service technology will be created.
Fig. 9. Adding a web service. Available Services tab

Adding links to assemblies

If you want to add an assembly to your script, go to the Settings panel and click Add - Add link to the assembly (Fig. 6). You can also do it by opening the context menu of the settings panel and selecting the Add link to the assembly option (Fig. 7). In the provided window, (Fig. 10) select the desired assembly and click OK.
Fig. 10. Adding a link to an assembly
The listed assemblies are divided into two types:
Copyright © 2006–2019 ELMA