Priority change from history

Priority change from history



SELECT wo.WORKORDERID "Request ID",
       wo.TITLE "Subject",
       qd.QUEUENAME "Group",
       ti.FIRST_NAME "Technician",
       LONGTODATE(wo.CREATEDTIME) "Created Time",
       LONGTODATE(wo.DUEBYTIME) "DueBy Time",
       rtdef.NAME "Request Type",
       LONGTODATE(OPERATIONTIME) OPERATIONTIME,
       pd1.priorityname "Changed From",
       pd2.priorityname "Changed To",
       aau1.FIRST_NAME "PERFORMEDBY" FROM WorkOrder wo
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 WorkOrderHistory woh ON wo.WORKORDERID = woh.WORKORDERID
LEFT JOIN WorkOrderHistoryDiff wohd ON woh.HISTORYID = wohd.HISTORYID
LEFT JOIN AaaUser aau1 ON aau1.USER_ID = woh.OPERATIONOWNERID
LEFT JOIN PriorityDefinition pd1 ON cast(cast(wohd.prev_value AS varchar) AS int)=pd1.PRIORITYID
LEFT JOIN PriorityDefinition pd2 ON cast(cast(wohd.current_value AS varchar) AS int)=pd2.PRIORITYID
WHERE wohd.COLUMNNAME IN ('PRIORITYID')
  AND wo.CREATEDTIME >= <from_thisweek>
  AND wo.CREATEDTIME <= <to_thisweek>
ORDER BY 1,
         OPERATIONTIME DESC

 

Note : Login to ServiceDesk Plus, go to Reports tab > New Query Report > Copy the query to the query editor and run the report. 


                  New to ADSelfService Plus?

                    • Related Articles

                    • Change Status history

                      SELECT chdt.changeid                       "Change ID",         chdt.title                          "Title",         orgaaa.first_name                   "Requested by",         ownaaa.first_name                   "Technician",  ...
                    • Change stage history

                      SELECT chdt.changeid                       "Change ID",         chdt.title                          "Title",         orgaaa.first_name                   "Requested by",         ownaaa.first_name                   "Technician",  ...
                    • Query to retrieve users login and logout history and find their current status

                      REQUIREMENT: To generate a report that contains the login and logout history of users and to determine the current user status. TESTED IN: Builds 14503 (Postgres) QUERY 1: The following query provides the login and logout history of users. SELECT ...
                    • Technician change from history

                      This report is used to find who changed the Technician and how many technician handled the request.  To make any changes to a query, refer to the KB article below. ...
                    • Risk matrix for Change using Custom module

                      UseCase: Risk need to be calculated through Risk matrix (similar to Priority matrix in the request module) Steps to configure: Configure custom module as in the attached screenshot. 1. Navigate to Admin --> Developer space --> Custom module --> ...