KACE Report open ticket by individual technicians
Hello,
I need to write a report that shows open tickets for each technician on our servicedesk. I need a report per tech and not one overall report that shows everyone. I inherited this system, so I am a bit out of my element. Below is an existing report that works but shows all techs in one report. I would like to edit this report to only show one tech and then I would just make multiple reports and name each report by their name if that makes sense. I figured I only needed to change the USER.ID to the individual tech's login, but that did not work. Any help will be appreciated.
select HD_TICKET.ID,
HD_TICKET.TITLE ,
HD_TICKET.DUE_DATE,
CONCAT(IF(TIME_TO_SEC(NOW()) >= TIME_TO_SEC(HD_TICKET.TIME_OPENED),
TO_DAYS(NOW()) - TO_DAYS(HD_TICKET.TIME_OPENED),
TO_DAYS(NOW()) - TO_DAYS(HD_TICKET.TIME_OPENED) - 1), 'd ',
DATE_FORMAT(ADDTIME("2000-01-01 00:00:00",
SEC_TO_TIME(TIME_TO_SEC(NOW())-TIME_TO_SEC(HD_TICKET.TIME_OPENED))),
'%kh %im')) AS TIME_OPEN,
HD_PRIORITY.NAME as PRIORITY,
HD_CATEGORY.NAME as CATEGORY,
HD_STATUS.NAME as STATUS,
HD_IMPACT.NAME as IMPACT,
MACHINE.NAME as MACHINE_NAME,
ifnull((select FULL_NAME from USER where HD_TICKET.OWNER_ID = USER.ID),' Unassigned') as OWNER_NAME,
(select FULL_NAME from USER where HD_TICKET.SUBMITTER_ID = USER.ID) as SUBMITTER_NAME
from HD_TICKET
left join HD_CATEGORY on HD_CATEGORY_ID = HD_CATEGORY.ID
left join HD_STATUS on HD_STATUS_ID = HD_STATUS.ID
left join HD_PRIORITY on HD_PRIORITY_ID = HD_PRIORITY.ID
left join HD_IMPACT on HD_IMPACT_ID = HD_IMPACT.ID
left join MACHINE on HD_TICKET.MACHINE_ID = MACHINE.ID
where HD_STATUS.STATE = 'opened'
order by OWNER_NAME, HD_PRIORITY.ORDINAL, HD_CATEGORY.ORDINAL, HD_STATUS.ORDINAL, HD_IMPACT.ORDINAL
Thank you,
Jeremy
Answers (2)
Thank you for the information. Where do I pull the Ticket Owner ID from? For the Ticket Owner ID, I tried the name, email, and login. I get the same error using all three. If I use 155 the report is blank.
mysqli error: [1054: Unknown column 'jeremy.h' in 'where clause'] in EXECUTE(\n"select HD_TICKET.ID, \n HD_TICKET.TITLE ,\n HD_TICKET.DUE_DATE,\n CONCAT(IF(TIME_TO_SEC(NOW()) >= TIME_TO_SEC(HD_TICKET.TIME_OPENED),\n TO_DAYS(NOW()) - TO_DAYS(HD_TICKET.TIME_OPENED),\n TO_DAYS(NOW()) - TO_DAYS(HD_TICKET.TIME_OPENED) - 1), 'd ', \n DATE_FORMAT(ADDTIME("2000-01-01 00:00:00",\n SEC_TO_TIME(TIME_TO_SEC(NOW())-TIME_TO_SEC(HD_TICKET.TIME_OPENED))),\n '%kh %im')) AS TIME_OPEN,\n HD_PRIORITY.NAME as PRIORITY, \n HD_CATEGORY.NAME as CATEGORY, \n HD_STATUS.NAME as STATUS, \n HD_IMPACT.NAME as IMPACT,\n MACHINE.NAME as MACHINE_NAME,\n ifnull((select FULL_NAME from USER where HD_TICKET.OWNER_ID = USER.ID),' Unassigned') as OWNER_NAME,\n (select FULL_NAME from USER where HD_TICKET.SUBMITTER_ID = USER.ID) as SUBMITTER_NAME\nfrom HD_TICKET\nleft join HD_CATEGORY on HD_CATEGORY_ID = HD_CATEGORY.ID\nleft join HD_STATUS on HD_STATUS_ID = HD_STATUS.ID\nleft join HD_PRIORITY on HD_PRIORITY_ID = HD_PRIORITY.ID\nleft join HD_IMPACT on HD_IMPACT_ID = HD_IMPACT.ID\nleft join MACHINE on HD_TICKET.MACHINE_ID = MACHINE.ID\nwhere HD_STATUS.STATE = 'opened' and HD_TICKET.OWNER_ID = jeremy.h\norder by OWNER_NAME, HD_PRIORITY.ORDINAL, HD_CATEGORY.ORDINAL, HD_STATUS.ORDINAL, HD_IMPACT.ORDINAL LIMIT 0")
Thanks!
Jeremy
Comments:
-
Use the USER.ID for the tech you want to report on.
Create a SQL report to find the USER.ID number.
select ID, FULL_NAME from USER - KevinG 1 day ago