User Tools
Table of Contents
Ticketer - Email Parse Rules
Email parsing rules are groovlets associated with Dig Ticket Call Centers. A Call Center will send an email to an inbox we monitor and if the sender email address matches an email address belonging to a Call Center, it will parse the email into a ticket based on the rule associated with that Call Center.
CBYD Email Parsing Rule Project
Obtain the CbydEmailParsing project from bitbucket and get it running on local machine. If you are having issues with this feel free to ask a co-worker or your mentor to assist.
When taking a rule from production, to import it make sure to take the code from production between
// Determine type of email (i.e. Normal, Emergency, Update, Notification, etc)
and
log.info "Dig Ticket '${digTicketCallCenter.name}' Groovlet: Finished Parsing Dig Ticket Email"
and in the Parsing project paste the code between
// Determine type of email (i.e. Normal, Emergency, Update, Notification, etc) and // ***************** Rule ends here ***************** //
You may get an error in the project for DateLocalizer. If this occurs replace
dateLocalizer =new com.errigal.ticketer.utils.DateLocalizer
with
def dateLocalizer =new DateLocalizer
remember to undo this change before placing the rule back on production
Writing the Groovlet
Examples can be found by clicking into a Call Center (Ticketer/digTicketCallCenter/list) and then clicking its Ticket Email Parse Rule.
It should be in the format :
| RULE FORMAT |
|---|
| Imports |
| Email, Workflow and Visibility |
| Is the email Ticketable and what severity |
| Split String to obtain desired data |
| Assign data to ParsedDigTicketEmail object |
Rules may differ greatly from one another due to how different Dig Centers format their emails. A different email format means a different parsing rule.
The key to extracting information from strings is the utils.retrieveTokenResult method. This takes in a string, the first string to look for and the seconds string to look for and returns what is in between such that utils.retrieveTokenResult(“Where is he going with this”, “Where ”, “ this”) == “is he going with”
This method will mostly be used on the emailBody which you will pull back most information from
An important point to note is that emails may come in from the same Dig Center however the format is slightly different so your rule will need to accommodate this. Also emails of different severities may have slightly different formats such as an Emergency may be different to a Routine.
Try to use Regex for finding data where possible as whitespace can cause issues with different emails having a different number of whitespace at the same locations.
The overall goal is to populate as many field in ParsedDigTicketEmail as possible.
Tips and Tricks
The following tips and tricks may come in useful when parsing emails:
- Always make a backup of the original parsing rule before you make any changes! This allows the original rule to be reinstated if need be
- When copying the email body into IDEA for testing don't forget to also copy in the subject line - this dictates whether the email is ticketable or not
- Set breakpoint/s within IDEA and use the debugger to ensure that the information being parsed in correct
- When you are happy that the issue has been fixed, attempt to parse older emails from the same call center to ensure that the changes work
- Don't forget to reparse the original email that caused the issue - this is done by marking the email as 'unread' within Gmail
Assessment
Try and write the parsing rule for this by taking the first email parsing rule in the list of dig ticket call centres and making it work for this email format instead.
Please do not just copy the appropriate rule for this email and try write it manually.
Email Subject
Errigal Hotline Ticket 20163504815
Email Body
Errigal Hotline, Inc. (San Francisco)
Ticket #: 20163504815 Seq: 2 Previous Ticket #: 20163502787
Header: RELO-PRIORITY 1 Type: RELOCATE Operator: 141
This ticket has been relocated 2 times
Start Date : 08/23/2016 Time: 09:05:00 AM
Call Date : 08/23/2016 Time: 07:55:48 AM
Transmit Date: 08/23/2016 Time: 08:05:20 AM
Caller: NICOLE FAREWELL Phone: (262)255-4888
DAVID J FRANK LANDSCAPING
N120W21350 FREISTADT RD
GERMANTOWN
WI 53022
nicole.farewell@davidjfrank.com
Field Rep.: JEFF MILLER Phone: (262)894-1162
County : MILWAUKEE
Place : MILWAUKEE CITY
At : 745
Street : N PROSPECT AVE
Intersection 1: E WISCONSIN AVE
Intersection 2:
On the W side of street and approximately 0.00 FT N of Intersection 1
Latitude NW 43.04043100 Longitude NW -87.90289400
Latitude SE 43.03901400 Longitude SE -87.89941700
Type of Work: LANDSCAPING
Working For : HOMEOWNER
Explosives: N Overhead: N Boring Equipment: N Premarked: N
Marking Instructions:
MARK AREA FROM CURB TO FENCE ALONG N PROSPECT/E WISCONSIN FROM E MASON
TO N VAN BUREN.
Remarks:
CALL MARK SCHUTZ ON SITE WITH QUESTIONS: 262-894-1336 OR MIKE MAURER:
262-894-7005
Members Notified:
*CROWN CASTLE CCA01 (CCA01) TIME WARNER CABLE - TWC40 (TWC40)
WE ENERGIES - WE31WG (WE31W) AT&T DISTRIBUTION SBC01 (SBC01)
WE ENERGIES (WESTM) MIDWEST FIBER NETWORKS (MWF01)
CITY OF MILWAUKEE MES01 (MES01) WINDSTREAM (NRL02)
MCI MCI01 (MCI01) AT&T TRANSMISSION TCG TCG01 (TCG01)
CTLQN - CENTURYLINK QTC01 (QTC01) LEVEL 3 COMMUNICATIONS WCI01 (WCI01)