Scripts

Introduction to scripts in ConSol CM

Scripts are used for providing the logic for the processes which are modeled in ConSol CM. They are a key component for adapting the system to the required use cases. ConSol CM brings an extensive API which provides methods to access and modify ConSol CM objects.

Concepts, terms and definitions

Concept

Other terms

Definition

script

 

A script is a piece of code which is executed on the ConSol CM server or in the browser.

Groovy

 

Groovy is the programming language used for most of the scripts in ConSol CM. It is compatible with Java.

Java

 

Java is an object-oriented programming language which can be used in Groovy scripts.

JavaScript

 

JavaScript is a programming language which can be used in widget and field visualization scripts in ConSol CM.

ConSol CM API

 

The ConSol CM API provides methods to access and modify objects in the ConSol CM database.

Purpose and usage

Scripts are used for adding additional logic to the processes in ConSol CM. They define the behavior of the system in various areas, as for example emails, actions, widgets or workflows.

Most scripts are written in Groovy, an object-oriented programming language which is compatible with Java. You can use JavaScript for scripts which implement widgets and field visualizations in the Web Client.

Scripts which are used in the workflow can be saved either in the Admin Tool / Web Admin Suite or in the Process Designer. All other scripts are saved in the Admin Tool / Web Admin Suite.

Available settings for scripts

A script has three settings:

The following table shows the available script types:

Type

Description

Link

Action form condition

Determines if an action form for a contact action, resource action, or search action should be displayed. Is assigned to the action.

Control Forms

Action form prefill

Prefills the data fields in an action form. Is assigned to the action.

Control Forms

Calendar integration

Provides the connection information for the integration of Microsoft Exchange calendars. Is referenced in the page customization of the calendar section.

Microsoft Exchange Calendar Integration

Clone

Changes the values with which the newly created case is automatically prefilled when cloning a case. Is assigned to the queue.

Scripts of the type Clone

Contact action

Implements a contact action. Is assigned to the action.

Action scripts

Contact condition

Determines if a contact action is available. Is assigned to the action.

Action scripts

Default values

Prefills data when creating a new case. Is assigned to the queue.

Scripts of type Default values

Dependent enum

Defines hierarchical data structures for data fields. Is assigned to the data field group.

Scripts of type Dependent enum

Email

Manages incoming and outgoing emails. Some email scripts are part of the ConSol CM delivery. Is assigned to the queue.

Scripts of the type Email

Field visualization

Configures the visualization of data fields. Is assigned to the data field.

Scripts of the type Field visualization

Integration

Implements a service which uses the webhook interface of ConSol CM

Webhooks

News publisher

Configures the news feature.

Scripts of the type News publisher

Page customization

Provides settings for the page customization. Is referenced in the page customization section.

The script type Widget can be used interchangeably with this type. We recommend to use the type Page customization for scripts which are referenced in page customization scopes or types, and to use the script type Widget for scripts which are used to implement dashboard widgets, so that you can distinguish the scripts easily.

Page customization

Relation graph

Configures the graph display of relations in the relation section of the Web Client. Is referenced in the page customization of the section.

Relation graphs

Resource action

Implements a resource action. Is assigned to the action.

Action scripts

Resource condition

Determines if a resource action is available. Is assigned to the action.

Action scripts

Search action for cases

Implements an action for a Detailed Search result containing cases. Is assigned to the action

Action scripts

Search action for contacts

Implements an action for a Detailed Search result containing contacts. Is assigned to the action

Action scripts

Search action for resources

Implements an action for a Detailed Search result containing resources. Is assigned to the action

Action scripts

Search condition for cases

Determines if an action for a Detailed Search result containing cases is available. Is assigned to the action.

Action scripts

Search condition for contacts

Determines if an action for a Detailed Search result containing contacts is available. Is assigned to the action.

Action scripts

Search condition for resources

Determines if an action for a Detailed Search result containing resources is available. Is assigned to the action.

Action scripts

System documentation

Configures the system documentation export.

Scripts of the type System documentation

Task

Implements a task which can execute any code in the system.

Creating a task script

Text autocomplete

Defines scripted autocomplete lists for data fields. Is assigned to the data field.

Scripts of the type Text autocomplete

Web form condition

Determines if a web form can be accessed by a client. Is assigned to the web form.

CM/Forms

Widget

Implements the widgets which can be displayed on the dashboards. Is referenced in the page customization section.

The script type Page customization can be used interchangeably with this type. We recommend to use the type Page customization for scripts which are referenced in page customization scopes or types, and to use the script type Widget for scripts which are used to implement dashboard widgets, so that you can distinguish the scripts easily.

Scripts of the type Widget

Widget visualization

Implements generic widgets which allow visualizing any HTML content. Is assigned to the widget in the page customization.

Scripts of the type Widget visualization

Workflow

Scripts which are referenced from workflows.

Scripts of the type Workflow

Basic tasks

Finding a script

The list of scripts is displayed directly after accessing the Scripts section of the Web Admin Suite. You can filter the list to locate a script more easily:

Working with scripts

You can perform the following actions on scripts:

Advanced tasks

Using the script editor features

The script editor has the following features:

Using special actions

Depending on the script type, an additional button with a special action can be displayed in the upper left corner of the script editor. Currently, two special actions are available:

Script type

Action

Description

Integration

Webhook configuration

Opens the configuration page of the webhook which belongs to the script. See Webhooks.

Task

Execute task

Creates and executes a task with the given task script. See Tasks.

Saving workflow scripts in the Web Admin Suite

When using scripts in a workflow, you can either save the scripts within the workflow (in the Process Designer) or reference a script stored in the Admin Tool / Web Admin Suite from within the workflow.

Advantages of storing workflow scripts in the Admin Tool / Web Admin Suite:

Advantages of storing workflow scripts in the Process Designer:

Please proceed as follows to save a workflow script in the Web Admin Suite:

  1. Create the script with the type Workflow in the Web Admin Suite.

  2. Reference the script from the desired place in the workflow in the Process Designer.

    scriptExecutionService.execute("myscript.groovy")

    Optionally, you can pass parameters to the script, e.g., the case or the main contact:

    def params = [ "myticket": workflowApi.ticket ]

    scriptExecutionService.execute("myscript.groovy", params)

    The variable myticket can be used in the script afterwards to access the case. Alternatively, you can retrieve it directly in the script using methods of the object workflowApi.