Sending emails and notifications

There are two ways of informing the users about events which are not related to the object which they are currently working on:

Sending emails

There are different ways of sending emails from workflows. The following list provides an overview of the classes and methods which can be applied and discusses the advantages and disadvantages of each variant.

Class

Advantages

Disadvantages

Comment

Mail

 

Use the method send() to send the email (not part of the API documentation of the class).

workflowAPI

The method sendEmail() has signatures which allow to provide a list of recipients directly as a parameter.

Use the method sendEmail().

mailService

  • Sends emails asynchronously

  • Better performance

  • Available from any context

  • Cannot send attachments.

  • Cannot send an email to several recipients.

 

Please refer to the ConSol CM API documentation to learn details about all the methods which are provided by the respective classes.

Please consider the following aspects when sending emails in the workflow:

Handling of user representations in emails sent in scripts

When sending emails using scripts, you need to define the desired behavior if the recipient is a ConSol CM user who is currently being represented by another user. See Configuring representations for details about representations.

The handling of automatic emails can be defined if the class Mail is used to create the email:

Sending notifications

Notifications are displayed when clicking the bell icon in the header of the Web Client. If the user allows notifications in the browser, they can also appear in the Windows system tray.

Figure 15: ConSol CM Web Client - Notification with a case link

Automatic notifications can be used to inform users about events which occur in their cases. The code which creates the notification can be placed for example in the automatic activity after a trigger.

Example: When an email is received for a case, you can add an overlay to the case icon and send a notification to the assignee. For this purpose, you only need to add an email trigger connected to an automatic activity, where the overlay is added and the notification is sent. The notification can include a link to the case.

The script for this activity could look as follows:

def myEngineer = workflowApi.engineer.name

def myTicket = workflowApi.ticket.name

if (myEngineer) {

broadcasterService.notificationBuilder().

withSenderName("System").

withMessage("Email received in your case").

withNature("INFO").

withOrigin(myTicket).

withOriginContext("TICKET").

addRecipientName(myEngineer).

build().

send();

}

Code example 22: Workflow script to send a notification

The Missed notifications selector in the user profile allows the users to decide if they want to receive emails for missed notifications: