Admin Tool Scripts
Introduction to Scripts in the Admin Tool
Scripts are stored in the Scripts and Templates section of the Admin Tool. They are written in Groovy and should only be edited by experienced ConSol CM consultants and administrators.
To work with scripts, open the navigation item Scripts and Templates in the navigation group System in the Admin Tool. The tab Scripts will be shown.
Figure 391: ConSol CM Admin Tool - System, Scripts and Templates
On the left you see the list of all scripts. The list can be filtered using
- the drop-down menu where the script type can be selected.
- the input field for a text filter for the script name.
Two parameters have to be set for each script:
- Name
This is the name by which the script will be referenced, e.g., from the workflow or from other objects like queues. - Type
The script type. One of the following possible script types has to be selected:- Calendar integration
Scripts of this type provide the connection information for the integration of Microsoft Exchange calendars. See section Microsoft Exchange Calendar Integration. - Clone
Script which is executed when the Clone option is selected for a ticket. Has to be assigned to a queue. See section Scripts of the Type Clone for details. - Control form condition
Script which is executed to determine if an action form for a customer action, resource action, or search action should be displayed. Please see Control Forms for further information. - Control form prefill
Script which is executed when an action form is opened. It prefills data fields in the action form. Please see Control Forms for further information. - Customer action
Script which is executed when a customer action has occurred, see section Action Framework - Customer Actions for details. - Customer condition
Script which is executed to evaluate whether a customer action should be made available to the Web Client, see section Action Framework - Customer Actions for details. - Custom form condition
Script which is executed when a client tries to access a web form. It determines if the web form can be used by the client. See section CM/Forms for details. - Default values
Scripts of this type are used to define default values, i.e., values that are (pre)set in data fields when a new ticket is to be created. Please see section Scripts of Type Default Values for details. - Dependent enum
Scripts of this type are used to define dependent enums, structures which provide hierarchical lists. Please see section Scripts of Type Dependent Enum for details. - Email
Scripts of this type are used to manage incoming and outgoing emails. Please see section Scripts of Type Email for details. - Field visualization
Scripts of this type are used to configure the visualization of data fields. Please see section Scripts of Type Field Visualization for details. - Integration
Scripts of this type are used to implement services for the CM Webhooks interface. See section Webhooks for details. - News Publisher
Scripts of this type are used to implement news for the Web Client and/or CM/Track. See section Scripts of Type News Publisher for details. - Page customization
Scripts of this type are referenced by page customization settings. Please see sections Page Customization for the Web Client Dashboard and CM/Resource Pool - The Resource Pool Dashboard for details. The script type Widget can be used interchangeably with this type. Both types work exactly the same way. However, by using scripts of type Page customization for scripts which are referenced by page customization scopes or types and using script type Widget for scripts which are used to implement dashboard widgets, you can distinguish the scripts easily in the list of scripts (by sorting by type). - PostActivityExecutionScript (no specific type indicated)
An (optional) script which is executed after every manual workflow activity. See section PostActivityExecutionScript for details. - Relation graph
Scripts of this type are used to implement the graph display of relations in either standard sections or the expert section in ticket, customer (contact/company) and resource pages. For a detailed explanation, please refer to section Configuration of the Graphical Representation of Relations. - Resource action
Script which is executed when a resource action has taken place, see section CM/Resource Pool - Resource Actions for details. - Resource condition
Script which is executed to evaluate whether a resource action should be made available to the Web Client. See section CM/Resource Pool - Resource Actions for details. - Search action for customers
This script type is part of the Action Framework, namely the search actions, and is described in section Action Framework - Search Actions. - Search action for resources
This script type is part of the Action Framework, namely the search actions, and is described in section Action Framework - Search Actions. - Search action for tickets
This script type is part of the Action Framework, namely the search actions, and is described in section Action Framework - Search Actions. - Search condition for customers
This script type is part of the Action Framework, namely the search actions, and is described in section Action Framework - Search Actions. - Search condition for resources
This script type is part of the Action Framework, namely the search actions, and is described in section Action Framework - Search Actions. - Search condition for tickets
This script type is part of the Action Framework, namely the search actions, and is described in section Action Framework - Search Actions. - System documentation
This script type is used to create a file with the system documentation, please see section Scripts of Type System Documentation. - Task
Scripts of this type are used by the TEF (Task Execution Framework), please see section The Task Execution Framework (TEF). - Text Autocomplete
This script type is used to implement text autocomplete fields. Please see section Scripts of Type Text Autocomplete for details. - Widget
This script type is used for scripts which implement dashboards. This might be the dashboard on the Overview page (see section Page Customization for the Web Client Dashboard) or the resource pool dashboard (see section CM/Resource Pool - The Resource Pool Dashboard). The script type Widget can be used interchangeably with the script type Page customization. Both types work exactly the same way. However, by using scripts of type Page customization for scripts which are referenced by page customization scopes or types and using script type Widget for scripts which are used to implement dashboard widgets, you can distinguish the scripts easily in the list of scripts (by sorting by type). - Widget visualization
This script type is used for scripts which implement dashboards using generic widgets (see section Attributes for Generic Widgets. Please see section Scripts of Type Widget Visualization for details. - Workflow
Scripts of this type are referenced from the workflow. Please see section Scripts of Type Workflow for details.
- Calendar integration
The buttons below the list offer the standard Admin Tool functionalities:
- Add a script
- Edit a script
- Delete a script
- Copy a script
On the right you see the Source Code Editor. The script which is selected in the list on the left is displayed. Here you can write/edit the script source code when using edit mode.
The Source Code Editor
The Source Code Editor provides an editing panel with
- syntax highlighting
- code completion (use CTRL+SPACE, the classes in the locally executed tool, i.e. in the CLASSPATH, will be offered, not all classes and methods in ConSol CM)
- code validation (see display in the Compilation result box, since the validation is performed on the server side, all classes and methods of ConSol CM will be checked).
The interval between two code checks can be configured using the CM system property cmas-app-admin-tool, script.validation.interval.seconds.
The code validation can be disabled per session using the checkbox Disable validation below the editor pane.
By default, a simple version of the code validation is used to avoid false positives. You can activate a strict validation, which also checks if the invoked methods exist for the objects, by adding the following line to the script:
//enable-strict-mode
Please note that the strict mode might lead to false positives, for example when calling other scripts and using classes and methods defined in other scripts. Use the following syntax to add type hints to avoid such false positives:
//type-hint[someProperty:someClass]
Figure 392: ConSol CM Admin Tool - System, Scripts and Templates: Source Code Editor
The lower section of the Source Code Editor has the following buttons:
- Edit
Click this button to switch to edit mode in the Source Code Editor. When you open the navigation item Scripts and Templates in the Admin Tool, all scripts are in read-only mode to prevent an administrator from accidentally changing something. - Close edit mode and save changes
Save the script and quit edit mode, i.e., switch to read-only mode again. - Close edit mode without saving changes
Switch to read-only mode, without saving any changes you might have made to the source code. - Open script from file
This option opens a file browser. Two cases are possible:- The name of the selected file and the name of the script are identical.
In this case, the code of the script (in the Source Code Editor) will be completely replaced. - The name of the selected file and the name of the script differ.
In this case, a new script will be created with the name of the selected file. The new script will be displayed in edit mode in the Source Code Editor.
- The name of the selected file and the name of the script are identical.
- Save script to file
Here you can save the text of the script as a plain text file in the file system of the machine the Admin Tool is running on. - Update script from file
This option opens a file browser. The code in the Source Code Editor will be replaced by the text in the file, no matter if the names of the script and the file name are identical or not.
Script Types
In the following section, the available script types are explained. Some examples are provided to give you an idea of potential uses for scripts.
The following script types are explained here in this section. Please refer to the links provided in the list above for a complete overview of all script types with links to their respective documentation.
- Scripts of Type Text Autocomplete
- Scripts of the Type Clone
- Scripts of Type Email
- Scripts of Type Default Values
- Scripts of Type Dependent Enum
- Scripts of Type Field Visualization
- Scripts of Type News Publisher
- Scripts of Type System Documentation
- Scripts of Type Widget Visualization
- Scripts of Type Workflow
- PostActivityExecutionScript