Query to get Request task and worklog info

Query to get Request task and worklog info

Version : 13000
DB : MSSQL


OUTPUT :




SELECT "wo"."WORKORDERID" AS "Request ID",
"wo"."CREATEDTIME" AS "Created Time",
"wo"."TITLE" AS "Subject",
"wo"."DUEBYTIME" AS "DueBy Time",
"wo"."IS_CATALOG_TEMPLATE" AS "Service Request",
"aau"."FIRST_NAME" AS "Requester",
"ti"."FIRST_NAME" AS "Technician",
"pd"."PRIORITYNAME" AS "Priority",
"sdo"."NAME" AS "Site",
"std"."STATUSNAME" AS "Request Status",
"qd"."QUEUENAME" AS "Group",
"ad"."ORG_NAME" AS "Account",
(note.NOTESTEXT) "Notes",
tk.TITLE "Task",
ct. DESCRIPTION "WorkLog" FROM "WorkOrder" "wo"
LEFT JOIN "WorkOrderAccountMapping" "wam" ON "wo"."WORKORDERID"="wam"."WORKORDERID"
LEFT JOIN "PortalAccounts" "port_acc" ON "wam"."ACCOUNTID"="port_acc"."ACCOUNTID"
LEFT JOIN "AccountDefinition" "ad" ON "port_acc"."ACCOUNTID"="ad"."ORG_ID"
LEFT JOIN "SDUser" "sdu" ON "wo"."REQUESTERID"="sdu"."USERID"
LEFT JOIN "AaaUser" "aau" ON "sdu"."USERID"="aau"."USER_ID"
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 "StatusDefinition" "std" ON "wos"."STATUSID"="std"."STATUSID"
LEFT JOIN "PriorityDefinition" "pd" ON "wos"."PRIORITYID"="pd"."PRIORITYID"
LEFT JOIN "WorkOrder_Queue" "woq" ON "wo"."WORKORDERID"="woq"."WORKORDERID"
LEFT JOIN "QueueDefinition" "qd" ON "woq"."QUEUEID"="qd"."QUEUEID"
LEFT JOIN "SiteDefinition" "siteDef" ON "wo"."SITEID"="siteDef"."SITEID"
LEFT JOIN "SDOrganization" "sdo" ON "siteDef"."SITEID"="sdo"."ORG_ID"
LEFT JOIN workordernotes wono ON wo.WORKORDERID=wono.WORKORDERID
LEFT JOIN Notes note ON wono.notesid=note.notesid
LEFT JOIN WorkorderToTaskDetails wtk ON wo.WORKORDERID=wtk.WORKORDERID
LEFT JOIN  TaskDetails tk ON wtk.TASKID=tk.TASKID
LEFT JOIN WorkOrderToCharge wotoc ON wo.WORKORDERID=wotoc.WORKORDERID
LEFT JOIN ChargesTable ct ON wotoc.CHARGEID=ct.CHARGEID WHERE (wo.ISPARENT='1')


Note : Kindly Date filter option to avoid performance issue.

How to compare date column with auto filled date templates?
  1. 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
  2. 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>


                  New to ADSelfService Plus?