Query to fetch Task Worklog and related entity ID

Query to fetch Task Worklog and related entity ID

DB Compatibility : PGSQL & MSSQL
Build Compatibility : Builds above 9400

SELECT taskdet.TASKID AS "Task ID", taskdet.TITLE AS "Title", taskowner.FIRST_NAME AS "Owner", taskdet.MODULE AS "Module", wotask.WORKORDERID AS "Request ID", taskprob.PROBLEMID AS "Problem ID", taskchange.CHANGEID AS "Change ID", taskproject.PROJECTID AS "Project Id",rctd.FIRST_NAME AS "Worklog Owner",LONGTODATE(ct.TS_STARTTIME) AS "Worklog Start time", LONGTODATE(ct.TS_ENDTIME) AS "Worklog End time", ct.DESCRIPTION AS "Worklog Description" FROM TaskDetails taskdet LEFT JOIN SDUser taskownersdu ON taskdet.OWNERID=taskownersdu.USERID LEFT JOIN AaaUser taskowner ON taskownersdu.USERID=taskowner.USER_ID LEFT JOIN WorkOrderToTaskDetails wototaskdet ON taskdet.TASKID=wototaskdet.TASKID LEFT JOIN WorkOrder wotask ON wototaskdet.WORKORDERID=wotask.WORKORDERID LEFT JOIN ProblemToTaskDetails probtotaskdet ON taskdet.TASKID=probtotaskdet.TASKID LEFT JOIN Problem taskprob ON probtotaskdet.PROBLEMID=taskprob.PROBLEMID LEFT JOIN ChangeToTaskDetails changetotaskdet ON taskdet.TASKID=changetotaskdet.TASKID LEFT JOIN ChangeDetails taskchange ON changetotaskdet.CHANGEID=taskchange.CHANGEID LEFT JOIN TaskToProjects projtotaskdet ON taskdet.TASKID=projtotaskdet.TASKID LEFT JOIN ProjectDetails taskproject ON projtotaskdet.PROJECTID=taskproject.PROJECTID LEFT JOIN TaskToCharge toc ON taskdet.TASKID = toc.TASKID LEFT JOIN ChargesTable ct ON toc.CHARGEID=ct.CHARGEID LEFT JOIN SDUser rcti ON ct.TECHNICIANID=rcti.USERID LEFT JOIN AaaUser rctd ON rcti.USERID=rctd.USER_ID WHERE (taskdet.CREATEDDATE >= <from_thismonth>) AND (taskdet.CREATEDDATE <= <to_thismonth>)


In the above query, you can replace the <from_thismonth> and <to_thismonth> with the desired date filter. You can look for the available list of date filters here - Date Filter


                  New to ADSelfService Plus?

                    • Related Articles

                    • Task related reports (MSSQL)

                      Tested in MSSQL build (14306) Sample Output and headers present in this report Goto reports -> New query report and executes the following SELECT taskdet.TASKID AS "Task ID", taskdet.MODULE AS "Module", taskprior.PRIORITYNAME AS "Priority", ...
                    • Query to show both task comments and worklog comments ( MSSQL )

                      Tested in MSSQL build (14306) SELECT "taskdet"."TASKID" AS "Task ID", "taskdet"."TASKID" AS "Task ID", "wotask"."WORKORDERID" AS "RequestID", cd.CATEGORYNAME AS "Request Category", "taskgroup"."QUEUENAME" AS "Group", "taskowner"."FIRST_NAME" AS ...
                    • Query to retrieve worklog details

                      Tested in: 14610 (Postgres) Query: SELECT wo.WORKORDERID AS "Request ID", aau.FIRST_NAME AS "Requester", sdo.NAME AS "Site", ti.FIRST_NAME AS "Request Technician" ,au1.FIRST_NAME AS "Worklog Technician", TO_CHAR(((sum(ct.TIMESPENT))/1000 || ' ...
                    • Complete worklog report -MSSQL

                      Query: SELECT aau.FIRST_NAME AS "Requester", max(wo.WORKORDERID) AS "Request ID", rtdef.NAME AS "Request request type", wo.TITLE AS "Subject", wo.description , std.STATUSNAME AS "Request Status", ti.FIRST_NAME AS "Assigned Technician", ...
                    • Option to cancel the pending tasks when Request is cancelled- when the worklog is mandatory

                      Requirement: Customer needs to close the tasks when the request is closed and the worklog is mandatory field in request closing rules. Download the attached scripts. Under Admin > Developer Space > Global Custom Function, create a new custom ...