Service Desk - Copy comment from parent ticket to children, and preserve the Owners Only Flag?
Hi all,
I'm having trouble building a rule that processes on save and takes comments from a parent ticket and adds them to the children, while preserving the Owners Only flag. Does anyone out there do this today?
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
h2opolo25
9 years ago
This is the query that I use for that....
-- SELECT SQL:
SELECT PARENT.TITLE,
HD_TICKET.TITLE,
HD_TICKET.ID,
PARENT.CUSTOM_FIELD_VALUE1,
PARENT.CUSTOM_FIELD_VALUE2,
PARENT.CUSTOM_FIELD_VALUE3,
PARENT.CUSTOM_FIELD_VALUE4,
PARENT.CUSTOM_FIELD_VALUE5,
PARENT.CUSTOM_FIELD_VALUE6,
PARENT.CUSTOM_FIELD_VALUE7,
PARENT.CUSTOM_FIELD_VALUE8,
C.COMMENT
FROM HD_TICKET PARENT, HD_TICKET, HD_TICKET_CHANGE C
WHERE PARENT.ID = HD_TICKET.PARENT_ID
and PARENT.HD_QUEUE_ID = 9 -- change to desired queue
and C.HD_TICKET_ID = HD_TICKET.ID
AND HD_TICKET.CREATED > DATE_SUB(NOW(), INTERVAL 10 SECOND)
-- UPDATE SQL:
UPDATE HD_TICKET PARENT,HD_TICKET_CHANGE C, HD_TICKET
SET HD_TICKET.TITLE = PARENT.TITLE,
C.COMMENT = concat(
'Office: ',
PARENT.CUSTOM_FIELD_VALUE1,
' Company: ',
PARENT.CUSTOM_FIELD_VALUE2,
' EmployeeID: ',
PARENT.CUSTOM_FIELD_VALUE3,
' Start Date: ',
PARENT.CUSTOM_FIELD_VALUE4,
' GP Account: ',
PARENT.CUSTOM_FIELD_VALUE5,
' Time Entry Account: ',
PARENT.CUSTOM_FIELD_VALUE6,
' Pivots Account: ',
PARENT.CUSTOM_FIELD_VALUE7,
' Bid Log Account: ',
PARENT.CUSTOM_FIELD_VALUE8
)
C.OWNERS_ONLY = 1
WHERE PARENT.ID = HD_TICKET.PARENT_ID
and C.HD_TICKET_ID = HD_TICKET.ID
and HD_TICKET.HD_QUEUE_ID = 4 -- change to desired queue
AND HD_TICKET.ID IN (<TICKET_IDS>)
Comments:
-
Does this make every comment on the child an Owners Only comment, or just the stuff that is already Owners Only? - anonymous_112053 9 years ago
-
The rule transfers one comment over when the ticket is created. If you were to remove the last line on the select statement it would append the custom field info to every comment and also make all comments owners only.
This rule is meant as a template. You need to customize it to your environment. - h2opolo25 9 years ago
-
what about copying all the comments from a parent ticket to the child ticket instead of Custom fields? - wafflesid 9 years ago