Skip to main content
Version: 6.18

Scripting and REST API improvements

The following improvements to the ConSol CM API and REST API have been made.

Method for specifying fonts for PDF generation from XHTML (#665177)

A new signature has been added to the method generatePDFDocumentFromXHTML() from the class ContentFileTemplateService to allow specifying the font to be used in the generated PDF. Previously, the method defaulted to using the Roboto font, ignoring any font family specified by CSS.

For specifying the font, you need to use the following signature:

generatePDFDocumentFromXHTML(String pFileName, String pXHTML, InputStream pCssInputStream, PdfConfiguration pPdfConfiguration)

The PdfConfiguration object allows to add custom fonts by specifying the font name and the path to the font file. The font files must be accessible on the ConSol CM server.

Example:

def pdfContentFile = contentFileTemplateService.generatePDFDocumentFromXHTML(fileName, xhtml, new ByteArrayInputStream(css.getBytes()), new PdfConfiguration().addFont('DejaVu Sans', '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf'))

Method for creating an AI-based case summary (#665676)

The ConSol CM API has been extended by a method to generate AI-based summaries of the case communication. This method can be used to implement workflow activities which help the users quickly grasp the essence of lengthy cases.

The method summarizeTicket has been added to the class TicketService for this purpose. There are three signatures of the method which allow the script creator to decide whether the summary should be written to the case history automatically and whether the whole case communication or only some of the case entries should be considered.

Precondition

This method only works if a valid LLM connection is specified in the new system property summaryService.llm.configurationName of the module cmas-core-server.

The prompt used for sending the case data to the LLM is called summary prompt. It is created automatically as a system prompt on the Prompts page. You can fine-tune the prompt or use a custom one by creating a prompt and setting it in the new system property summaryService.llm.promptName of the module cmas-core-server.

Non-transactional mode for task execution (#665691)

Tasks scripts can now run in a non-transactional mode which allows to execute methods which must be run outside a transaction. This allows, for example, to use tasks for exporting data.

The mode is activated by setting taskDescriptor.setManualTransactionMode(true) in the onInitialize method of the task:

def onInitialize(taskDescriptor) {
taskDescriptor.setManualTransactionMode(true)
}

If you use methods which need a transaction in the same task, you need to wrap them in a transaction template:

transactionTemplate.executeWithoutResult(transactionStatus -> {
var ticket = ticketService.getById(100839)
ticket.getQueue().getName()
});