Query to get Service Request Approval Details

Query to get Service Request Approval Details

Version : 10609
Database : MSSQL

Output:




SELECT "wo"."IS_CATALOG_TEMPLATE" AS "Service Request",
"serdef"."NAME" AS "Service Category",
"appStDef"."STATUSNAME" AS "Approval Status",
"cd"."CATEGORYNAME" AS "Category",
"ti"."FIRST_NAME" AS "Technician",
"ServiceReq_307"."UDF_DATE1" AS "Created Date",
"ci"."CINAME" AS "Asset Name",
"dpt"."DEPTNAME" AS "Department",
LONGTODATE("wo"."CREATEDTIME") AS "Created Date",
LONGTODATE("wo"."COMPLETEDTIME") AS "Completed Date",
"cri"."FIRST_NAME" AS "Created By",
"ad"."ORG_NAME" AS "Account",
"qd"."QUEUENAME" AS "Group",
"wof"."UDF_CHAR53" AS "Name",
"wof"."UDF_CHAR22" AS "Server Name",
"ServiceReq_1801"."UDF_CHAR1" AS "Reason",
"wo"."WORKORDERID" AS "Request ID",
LONGTODATE("wo"."RESOLVEDTIME") AS "Resolved Date",
"std"."STATUSNAME" AS "Request Status",
"scd"."NAME" AS "Subcategory",
"wo"."TITLE" AS "Subject",
"wo"."DESCRIPTION" AS "Description",
"rtl"."TEMPLATENAME" AS "Template Name",
"urgdef"."NAME" AS "Urgency",
"pd"."PRIORITYNAME" AS "Priority",
asd.stagename "Stage",
ApprovalDetails.EMAIL "Approver Email",
"appStDef".STATUSNAME "Approval Status" FROM "WorkOrder" "wo"
LEFT JOIN "CI" "ci" ON "wo"."CIID"="ci"."CIID"
LEFT JOIN "DepartmentDefinition" "dpt" ON "wo"."DEPTID"="dpt"."DEPTID"
LEFT JOIN "WorkOrderStates" "wos" ON "wo"."WORKORDERID"="wos"."WORKORDERID"
LEFT JOIN "CategoryDefinition" "cd" ON "wos"."CATEGORYID"="cd"."CATEGORYID"
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 "SubCategoryDefinition" "scd" ON "wos"."SUBCATEGORYID"="scd"."SUBCATEGORYID"
LEFT JOIN "UrgencyDefinition" "urgdef" ON "wos"."URGENCYID"="urgdef"."URGENCYID"
LEFT JOIN "ApprovalStatusDefinition" "appStDef" ON "wos"."APPR_STATUSID"="appStDef"."STATUSID"
LEFT JOIN "ServiceCatalog_Fields" "scf" ON "wo"."WORKORDERID"="scf"."WORKORDERID"
LEFT JOIN "WorkOrder_Queue" "woq" ON "wo"."WORKORDERID"="woq"."WORKORDERID"
LEFT JOIN "QueueDefinition" "qd" ON "woq"."QUEUEID"="qd"."QUEUEID"
LEFT JOIN "SDUser" "crd" ON "wo"."CREATEDBYID"="crd"."USERID"
LEFT JOIN "AaaUser" "cri" ON "crd"."USERID"="cri"."USER_ID"
LEFT JOIN "ServiceDefinition" "serdef" ON "wo"."SERVICEID"="serdef"."SERVICEID"
LEFT JOIN "WorkOrder_Fields" "wof" ON "wo"."WORKORDERID"="wof"."WORKORDERID"
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 "RequestTemplate_List" "rtl" ON "wo"."TEMPLATEID"="rtl"."TEMPLATEID"
LEFT JOIN "ServiceReq_307" ON "wo"."WORKORDERID"="ServiceReq_307"."WORKORDERID"
LEFT JOIN "ServiceReq_1801" ON "wo"."WORKORDERID"="ServiceReq_1801"."WORKORDERID"
JOIN ApprovalStageMapping ON wo.WORKORDERID=ApprovalStageMapping.WORKORDERID
LEFT JOIN approvalstage ON ApprovalStageMapping.APPROVAL_STAGEID=approvalstage.APPROVAL_STAGEID
LEFT JOIN ApprovalDetails ON ApprovalStageMapping.APPROVAL_STAGEID=ApprovalDetails.APPROVAL_STAGEID
LEFT JOIN approvalstagedefinition asd ON asd.STAGEID=ApprovalDetails.STAGEID
WHERE (wo.ISPARENT='1' AND wo.IS_CATALOG_TEMPLATE='1')

                New to ADSelfService Plus?