Query to know the technician changes in a ticket

Query to know the technician changes in a ticket


This will show the output only if the technician is assigned/updated in a ticket

1. Login to SDP MSP as administrator
2. Execute this from SDP MSP application -> Reports -> New Query report

SELECT wo.WORKORDERID AS "Request ID", 
wo.TITLE AS "Subject", 
wotodesc.FULLDESCRIPTION AS "Description", 
requester.First_Name As "Requester", 
srep.First_Name As "Suprep",  
sdf.StatusName As "Request Status",
qd.QUEUENAME AS "Group",
LONGTODATE(wo.createdtime) AS "CREATED Time",
LONGTODATE(wo.duebytime) AS "Due By time",
LONGTODATE(wo.completedtime) As "Completed time",
operationOwner.First_Name As "performedby",
LONGTODATE(wh.operationtime) As "operationtime",
prev.First_Name As "Technician changed from", 
cur.First_Name As "Technician changed to" ,
serdef.NAME AS "Service Category", 
pd.PRIORITYNAME AS "Priority", 
ad.ORG_NAME AS "Account", 
sdo.NAME AS "Site", 
rrs.RESOLUTION AS "Resolution" FROM WorkOrder wo
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID 
Left Join AAAUser requester ON wo.RequesterID=requester.User_Id 
Left Join AAAUser srep ON wos.OwnerID=srep.User_ID
Left Join StatusDefinition sdf ON wos.StatusID=sdf.StatusID 
LEFT JOIN WorkOrderToDescription wotodesc ON wo.WORKORDERID=wotodesc.WORKORDERID 
LEFT JOIN SiteDefinition siteDef ON wo.SITEID=siteDef.SITEID 
LEFT JOIN SDOrganization sdo ON siteDef.SITEID=sdo.ORG_ID 
LEFT JOIN ServiceDefinition serdef ON wo.SERVICEID=serdef.SERVICEID 
LEFT JOIN WorkOrder_Queue woq ON wo.WORKORDERID=woq.WORKORDERID
 LEFT JOIN QueueDefinition qd ON woq.QUEUEID=qd.QUEUEID 
 Left Join WorkorderHistory wh ON wo.WorkorderId=wh.WorkorderId 
 Left Join WorkorderHistoryDiff whd ON wh.HistoryID=whd.HistoryId
 Left Join AAAUser operationOwner ON wh.OperationOwnerid=operationOwner.User_Id
 Left Join AAAUser prev ON cast(cast(whd.prev_value as varchar) as int)=prev.User_Id
 Left Join AAAUser cur ON cast(cast(whd.current_value as varchar) as int)=cur.User_Id 
 LEFT JOIN PriorityDefinition pd ON wos.PRIORITYID=pd.PRIORITYID
LEFT JOIN RequestResolver rrr ON wo.WORKORDERID=rrr.REQUESTID 
LEFT JOIN RequestResolution rrs ON rrr.REQUESTID=rrs.REQUESTID 
LEFT JOIN AccountSiteMapping asm ON wo.SITEID=asm.SITEID 
LEFT JOIN AccountDefinition ad ON asm.ACCOUNTID=ad.ORG_ID 
where whd.ColumnName='OWNERID' AND  "wo"."CREATEDTIME" >= datetolong('2021-04-20')
  AND  "wo"."CREATEDTIME" <= datetolong('2021-04-21') 
AND cur.First_Name = 'administrator'

PS : change where criteria for technicians and dates.

                  New to ADSelfService Plus?