Automatically create a ticket from the receiving of an email
This functionality allows to automatically create tickets when an email 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 email, the functionality, after checking the existence of a message, automatically registers the ticket. It's important to highlight that after the ticket registration, the email is marked as read.
Before getting started
Make sure to configure an e-mail account to previously allow access via IMAP.
Also, configure the instance to use batch routines, since the email 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 email box
- Create the email automatic action by accessing the main menu System > Settings > Automatic Action Setting Via Email. This register is used to trigger the reading and register of requests (see Create automatic action via email).
Step 3 - Create a 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's possible to read the title of the email sent, it stored in the field the subject of the table reademaildatarequest.
In addition, if there is a need to retrieve other information contained in the email fields, as recipients marked as a 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()); }