First responded date for Service request
Query
SELECT wo.WORKORDERID "Request ID",max(mdd.MODENAME) "Request Mode",max(aau.FIRST_NAME) "Requester",max(qd.QUEUENAME) "Group",max(wo.TITLE) "Subject",max(rtdef.NAME) "Request Type",max(ti.FIRST_NAME) "Technician",max(std.STATUSNAME) "Request Status",longtodate(max(wo.CREATEDTIME)) "Created Time",
longtodate(min(nfs.NOTIFICATIONDATE)) "First responded Date" FROM WorkOrder_Threaded wot INNER JOIN WorkOrder wo ON wot.WORKORDERID=wo.WORKORDERID LEFT JOIN ModeDefinition mdd ON wo.MODEID=mdd.MODEID LEFT JOIN SDUser sdu ON wo.REQUESTERID=sdu.USERID LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID LEFT JOIN WorkOrder_Queue woq ON wo.WORKORDERID=woq.WORKORDERID LEFT JOIN QueueDefinition qd ON woq.QUEUEID=qd.QUEUEID LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID LEFT JOIN SDUser td ON wos.OWNERID=td.USERID LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID LEFT JOIN RequestTypeDefinition rtdef ON wos.REQUESTTYPEID=rtdef.REQUESTTYPEID LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID inner join notify_workorder nfws on nfws.workorderid=wo.workorderid inner join notification nfs on nfs.notificationid=nfws.notificationid and nfs.senderid!=1 left join aaauser an on nfs.senderid=an.user_id WHERE (wot.THD_WOID=wot.WORKORDERID) and wos.statusid in (1,2) and wo.CREATEDTIME >= <from_thisweek> AND wo.CREATEDTIME <= <to_thisweek> and wo.is_catalog_template='1' group by wo.workorderid
How to compare date column with auto filled date templates?
- Here is the example for getting this week data - CREATEDTIME >= <from_thisweek> AND CREATEDTIME <= <to_thisweek>
- <from_thisweek> - Starting date of this week
- <to_thisweek> - Ending date of this week
- Available Date Templates
- Today - <from_today> - <to_today>
- This week - <from_thisweek> - <to_thisweek>
- Last week - <from_lastweek> - <to_lastweek>
- This month - <from_thismonth> - <to_thismonth>
- Last month - <from_lastmonth> - <to_lastmonth>
- This quarter - <from_thisquarter> - <to_thisquarter>
- Last quarter - <from_lastquarter> - <to_lastquarter>
- Yesterday - <from_yesterday> - <to_yesterday>
Krishna Bharat
ServiceDesk Plus - MSP Support team