Creating Automatically a Ticket when Receiving an E-mail
This functionality allows creating an automatic ticket when an e-mail message is sent to a certain address. In this context, the solution constantly monitors the presence of messages in the mailbox, and if some message has the status of not read, this will be used to register a new ticket.
For example, a user should request a service by sending a message to [email protected], after receiving the e-mail, the functionality. After checking the existence of a message, automatically registers the ticket. It is important to highlight that after the ticket registration, the e-mail is marked as read.
Before getting started
To create a ticket through the receiving of an e-mail, it is necessary:
To configure an e-mail account to allow previous access via IMAP;
In addition, it is necessary to configure the instance to use batch routines, since the e-mail verification is a scheduled task.
Procedure
Step 1 - Creating Ticket Template
Access the functionality through the main menu System > Automatic actions > Incident/Request/Procedure Actions (see Register automatic actions of incident/request/procedure).
Step 2 - Set up Access to the E-mail box
Create the e-mail automatic action by accessing the main menu System > Settings > Automatic Action Setting via E-mail. This register is used to trigger the trading and register of requests (see Create automatic action via e-mail).
Step 3 - Create Verification Routine (batch)
Create a batch routine by accessing the main menu System > Batch Processing (see Batch Processing), of "Java Class" type with the following content:
br.com.centralit.citcorpore.quartz.job.JobConfiguracaoAberturaAutomaticaViaEmail🖊 Note: It is possible to read the title of the e-mail sent, which is stored in the field subject of the reademaildatarequest table.
In addition, if there is a need to retrieve other information contained in the email fields, as recipients marked as the copy (CC) or hidden copy (BCC) use the Rhino script below:
var importNames = JavaImporter(); importNames.importPackage(Packages.br.com.citframework.util); var print = java.lang.System.out; var readEmailDataDTO = serviceRequest.getReadEmailDataDTO(); if (readEmailDataDTO!=null){ print.println("Dados do E-mail de Origem: "); print.println("From: "); print.println(readEmailDataDTO.getMessageFrom()); print.println("To: "); print.println(readEmailDataDTO.getMessageTo()); print.println("CC (Carbon Copy): "); print.println(readEmailDataDTO.getMessageCC()); }