How can I setup a custom ticket rule that sends an email when a ticket is created with High/Critical Priority?
Answers (2)
Sure so if you have the id’s for all the analysts in team a, b or c, then you can create a Case statement to send an email to the correct team, simple right?
Not really as you can only send an email to a single address so you will need….
a group email address for each team
the email addresses for each team hidden in custom fields so you can call them into the rules as data variables and
probably a switch field so that the email is only sent once.
Simple ;o)
Top Answer
So each of these teams is a queue? Like team A is a queue? If so you can build a list of owners to send to. Just add a where statements which says if priority is critical.. No need for email lists, just use newticketemail as your email address in your rule. I too thought you could only have a single email address but somehow this works (I stole this from somewhere). /* group email */ is where the owners list is built. I give my owners 15 minutes to take the ticket before I send. So in this example, if the ticket is critical and no owner is assigned in 15 minutes (or less, not more because I have a 45 minute rule as well) then the email is sent to all owners of the queue. I set it to run every 15 minutes.. which means, in theory worst case, it might be 29 minutes.
So if Im understanding you are assigning to a user account called team A.. no need to do this. Sounds like maybe this was a workaround for your paging system? I dunno.. not fully understanding. Well, maybe this will help someone else if not you.
SELECT
-- ticket fields
HD_TICKET.ID, -- $id
HD_TICKET.ID AS TICKNUM, -- $ticknum
HD_TICKET.TITLE, -- $title
DATE_FORMAT(HD_TICKET.CREATED,'%b %d %Y %I:%i:%s %p') AS CREATED, -- $created
DATE_FORMAT(HD_TICKET.MODIFIED,'%b %d %Y %I:%i:%s %p') AS MODIFIED, -- $modified
-- change fields
C.COMMENT, -- $comment
C.DESCRIPTION, -- $description
-- about the owner
OWNER.USER_NAME AS OWNER_UNAME, -- $owner_uname
OWNER.FULL_NAME AS OWNER_FNAME, -- $owner_fname
OWNER.EMAIL AS OWNER_EMAIL, -- $owner_email
IFNULL(OWNER.USER_NAME,'Unassigned') OWNER_USER, -- $owner_user
-- about the submitter
SUBMITTER.USER_NAME AS SUBMITTER_UNAME, -- $submitter_uname
SUBMITTER.FULL_NAME AS SUBMITTER_FNAME, -- $submitter_fname
SUBMITTER.EMAIL AS SUBMITTER_EMAIL, -- $submitter_email
P.NAME AS PRIORITY, -- $priority
S.NAME AS STATUS, -- $status
I.NAME AS IMPACT, -- $impact
CAT.NAME AS CATEGORY, -- $category
-- -- Assign Email
OLIST.EMAIL AS NEWTICKETEMAIL -- $newticketemail
FROM
HD_TICKET
/* latest change ***/
JOIN HD_TICKET_CHANGE C ON C.HD_TICKET_ID = HD_TICKET.ID AND C.ID=<CHANGE_ID>
/* complete history*/ JOIN HD_TICKET_CHANGE H ON H.HD_TICKET_ID = HD_TICKET.ID
/* priority ********/ JOIN HD_PRIORITY P ON P.ID=HD_PRIORITY_ID
/* status **********/ JOIN HD_STATUS S ON S.ID=HD_STATUS_ID
/* impact-severity */ JOIN HD_IMPACT I ON I.ID=HD_IMPACT_ID
/* category ********/ JOIN HD_CATEGORY CAT ON CAT.ID=HD_CATEGORY_ID
/* owner ***********/ LEFT JOIN USER OWNER ON OWNER.ID = HD_TICKET.OWNER_ID
/* submitter *******/ LEFT JOIN USER SUBMITTER ON SUBMITTER.ID = HD_TICKET.SUBMITTER_ID
/* updater *********/ LEFT JOIN USER UPDATER ON UPDATER.ID = C.USER_ID
/* group email */
JOIN HD_QUEUE_OWNER_LABEL_JT ON HD_TICKET.HD_QUEUE_ID = HD_QUEUE_OWNER_LABEL_JT.HD_QUEUE_ID
JOIN USER_LABEL_JT ON HD_QUEUE_OWNER_LABEL_JT.LABEL_ID = USER_LABEL_JT.LABEL_ID
JOIN USER OLIST ON USER_LABEL_JT.USER_ID = OLIST.ID
/* queue */
JOIN HD_QUEUE ON HD_TICKET.HD_QUEUE_ID = HD_QUEUE.ID
where /* SET CORRECT QUEUE ID(S) HERE! */ HD_TICKET.HD_QUEUE_ID in (1) and P.NAME = 'Critical' and HD_TICKET.OWNER_ID = '0' and HD_TICKET.CREATED < SUBDATE(NOW(), INTERVAL 15 MINUTE)