Category From Parent to Child
Hi Guys,
I remember this being asked on here before but I can't seem to find the article. How can I automate the population of the Category from a parent ticket to child ticket? I have a rule that successfully populates custom fields, the ticket title and the comments, but all this fields are from the HD_TICKET table, how do I pull the Category Name from the HD_CATEGORY table?
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
chucksteel
9 years ago
You actually don't want to pull the category name from HD_CATEGORY. The category on the ticket is stored as HD_CATEGORY_ID so you can just use the value from the parent on the child.
Comments:
-
Hi Chuck,
thanks for the advise. I have tried using the HD_CATEGORY_ID in the rule, however it won't populate the Child Ticket. Here's the script I use, it was taken from one of the articles on this site.
Select SQL:
SELECT
PARENT.CUSTOM_FIELD_VALUE0,
HD_TICKET.TITLE,
HD_TICKET.ID
FROM
HD_TICKET PARENT, HD_TICKET
WHERE
PARENT.ID = HD_TICKET.PARENT_ID
Update SQL:
UPDATE HD_TICKET PARENT, HD_TICKET
SET
HD_TICKET.HD_CATEGORY_ID = PARENT.HD_CATEGORY_ID,
HD_TICKET.TITLE = PARENT.TITLE,
HD_TICKET.CUSTOM_FIELD_VALUE0 = PARENT.CUSTOM_FIELD_VALUE0
WHERE
((PARENT.ID = HD_TICKET.PARENT_ID) AND HD_TICKET.ID = <TICKET_IDS>) - Druis 9 years ago-
The rule should be running when the parent ticket is updated, is that correct? If so, then it should be PARENT.ID = <TICKET_IDS>. - chucksteel 9 years ago
Posted by:
zgillette
9 years ago
Druis,
Does the child ticket go to the same queue, or a different queue? If the parent and child are in the same queue, the ID will match. If the parent and child are in different queues, then it will not work, as each HD_CATEGORY_ID is the unique identifier for the HD_CATEGORY table.
Comments:
-
You are right, I never thought about the parent and child being different queues, as indeed they are in this case.
Is there no way to populate the Category from one Queue to the other? The Category values are identical, but obviously the Category IDs will be different. - Druis 9 years ago