Creating a Child Ticket with a Rule
I have a template for staff changes, including new users, and one of the options is whether the user will need a new computer, or if there is already a computer at that location for them. This is a template with it's own queue. There is a separate queue for new hardware requests. The IT staff are occasionally missing the selection in the original ticket, and while this should be dealt with through training, I am trying to generate a ticket for a new hardware request based on the option that is selected in the staff changes template. I can successfully create a ticket, and if I look at the tables I can see that the new ticket is created, and it shows up in KACE, but I can't open the ticket, I get an error message. I assume I'm missing something in the generation of the ticket, or there is another table that needs to be updated, but I'm not sure where to look.
This is that I have in my select statement for the rule (caveat, I'm not a programmer, clearly):
SELECT HD_QUEUE_ID, ID, TITLE, SUMMARY, SUBMITTER_ID, CUSTOM_FIELD_VALUE1, CUSTOM_FIELD_VALUE11, CUSTOM_FIELD_VALUE25, CUSTOM_FIELD_VALUE0, HD_STATUS_ID, CREATED, CUSTOM_FIELD_VALUE2, CUSTOM_FIELD_VALUE3, CUSTOM_FIELD_VALUE4, CUSTOM_FIELD_VALUE5, CUSTOM_FIELD_VALUE6, CUSTOM_FIELD_VALUE7, CUSTOM_FIELD_VALUE8, CUSTOM_FIELD_VALUE9, CUSTOM_FIELD_VALUE10, CUSTOM_FIELD_VALUE11, CUSTOM_FIELD_VALUE12, CUSTOM_FIELD_VALUE13, CUSTOM_FIELD_VALUE14, MACHINE_ID, HTML_SUMMARY, RESOLUTION, DUE_DATE, HD_SERVICE_STATUS_ID
FROM `ORG1`.`HD_TICKET`
WHERE HD_QUEUE_ID = 3
AND CUSTOM_FIELD_VALUE25 = 1 -- this is the option that a user selects if a new computer is required.
AND HD_STATUS_ID = 9
;
This is by update statement:
INSERT INTO HD_TICKET (TITLE, SUMMARY, HD_CATEGORY_ID, HD_PRIORITY_ID, HD_IMPACT_ID, CUSTOM_FIELD_VALUE0, SUBMITTER_ID, OWNER_ID, HD_QUEUE_ID, HD_STATUS_ID, CREATED, CUSTOM_FIELD_VALUE1, CUSTOM_FIELD_VALUE2, CUSTOM_FIELD_VALUE3, CUSTOM_FIELD_VALUE4, CUSTOM_FIELD_VALUE5, CUSTOM_FIELD_VALUE6, CUSTOM_FIELD_VALUE7, CUSTOM_FIELD_VALUE8, CUSTOM_FIELD_VALUE9, CUSTOM_FIELD_VALUE10, CUSTOM_FIELD_VALUE11, CUSTOM_FIELD_VALUE12, CUSTOM_FIELD_VALUE13, CUSTOM_FIELD_VALUE14, MACHINE_ID, HTML_SUMMARY, RESOLUTION, HD_SERVICE_STATUS_ID)
SELECT
'New Computer Request',
SUMMARY,
40,
1,
1,
CUSTOM_FIELD_VALUE0,
SUBMITTER_ID,
0,
1,
4,
NOW(),
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
MACHINE_ID,
HTML_SUMMARY,
'' ,
0
FROM `ORG1`.`HD_TICKET`
WHERE HD_QUEUE_ID = 3
AND CUSTOM_FIELD_VALUE25 = 1;
When I run it I can see that three tickets are created based on the three requests that have the option for new hardware selected.
My issue is that when I try to open one of those new tickets, I get the following message:
Answers (2)
I can’t say for sure but I think that in the HD_TICKET table, as the rule created the ticket, it probably is missing some mandatory data, so it shows the error when you try to look at the ticket.
I suggest you take a dump of the HD_TICKET table where HD_TICKET. ID is equal to the working parent ticket that you can look at and one of the child tickets you can’t open.
Then compare the data and see what the child ticket is missing, it may be a value in a template field or something similar.
When You know what is missing, add it into your update table.