Send email notification on add to queue
In KACE Service Desk, we've created several Queues for different user groups within our helpdesk.
Is there any way to send an email notification to the group of users associated with the queue when a ticket is moved into that queue? (I believe that would be the "Queue Owners")
Answers (4)
This is, what Custom Ticket Rules are for.
https://support.quest.com/kb/111161/
Comments:
-
Thank you, that was a good start! Confusing and convoluted, and an awful lot to figure out, but still a good start.
The problem is, I still don't see a way to attach a rule to a QUEUE change. Ticket Rules appear to be attached to individual queues (if I'm understanding this correctly), so that it only affects tickets within a specific queue. I don't see a way to set up a rule that tells the system to send an email to [group of people] when a ticket is created in a queue, or moved from Queue A to Queue B. - magusjs 3 years ago
There is a chance that this can fundamentally Not be done, mainly because in using a ticket rule to alert via email, you are only able to add a single email address into the variable field for the email addresses. So firstly, this will only email a group if the group is defined as a single email address, i.e. a mailing list.
If that is possible you need to identify what changes in the HD_TICKET table when the ticket is moved to the queue. In simple terms that may be the queue ID, but creating a ticket rule to fire when the ID is equal to say 4, would generate constant emails. If the move is to happen once, you may need to use a technique of a switch field, that is a hidden field with a default value of 1, when the email rule runs it also sets the value to 2, thus only allowing the rule to fire once. The select statement for the rule looking to run when the queue ID is 4 and the switch field is 1.
if it is likely that tickets will move queues more regularly, I would suggest adding a drop down in each queue ticket that triggers the move. So if the drop down contains Telecomms, set the queue ID to 4 and reset the switch field to 1, that way you get a fresh, single email alert.
I'm also trying to do something similar, however we are getting emails when the ticket is closed as well as opened. I'm using the following query. Is anyone able to help clean this up so we don't get an email when we also close the ticket?
select
HD_TICKET.ID as TICKNUM,
HD_TICKET.TITLE as TITLE,
HD_TICKET.OWNER_ID as OWNER,
HD_TICKET.CUSTOM_FIELD_VALUE14 as notified,
'GROUP@Email.com' as EMAILCOLUMN,
Q.NAME as Qu
from HD_TICKET
join HD_TICKET_CHANGE C on HD_TICKET.ID = C.HD_TICKET_ID
join HD_QUEUE Q ON HD_TICKET.HD_QUEUE_ID = Q.ID
where (C.DESCRIPTION like '%Ticket Created%' and HD_TICKET.OWNER_ID=0 and Q.NAME = 'Ticket-Queue-NameHere' AND HD_TICKET.CUSTOM_FIELD_VALUE14 !='1' and HD_TICKET.CUSTOM_FIELD_VALUE14 IS NOT NULL)
This is for moved to a queue sending to a email address. You can separate by comma's if multiple. If you want it by the owner label that can be done as well; see bottom.
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
GROUP_CONCAT(CONCAT('----- Change by ', UPDATER.EMAIL,' at ',H.TIMESTAMP,' -----\n',
H.DESCRIPTION,'\n',H.COMMENT,'\n\nPlease see your ticket at http://kbox.com/adminui/ticket.php?ID=',H.HD_TICKET_ID,'\n')
ORDER BY H.ID DESC SEPARATOR '\n') HISTORY, -- $history
-- about the updater
UPDATER.USER_NAME AS UPDATER_UNAME, -- $updater_uname
UPDATER.FULL_NAME AS UPDATER_FNAME, -- $updater_fname
UPDATER.EMAIL AS UPDATER_EMAIL, -- $updater_email
IF(UPDATER.FULL_NAME='',UPDATER.USER_NAME,UPDATER.FULL_NAME) AS UPDATER_CONDITIONAL, -- $updater_conditional
-- 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
-- about priority
P.NAME AS PRIORITY, -- $priority
-- about status
S.NAME AS STATUS, -- $status
-- about impact
I.NAME AS IMPACT, -- $impact
-- about category
CAT.NAME AS CATEGORY, -- $category
-- other fields
-- -- example of static distribution list
'yourgroup@yourdomain.com' 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
WHERE
C.DESCRIPTION like concat("%Changed ticket Queue from%to%.%")
/* this is necessary when using group by functions */
GROUP BY HD_TICKET.ID
HAVING 1=1
SUBJECT
[TICK:$ticknum] NEW TICKET: $title
COLUMN
NEWTICKETEMAIL
FOR SENDING TO OWNERS
/* 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
to create the newticketemail use
olist.email as newticketemail