Query to get list of service request templates created with Tasks associated to it. (MSSQL & PGSQL)

Query to get list of service request templates created with Tasks associated to it. (MSSQL & PGSQL)

Tested in builds from PGSQL (14300) or MSSQL (14306)

Execute the given query below from Reports-->New query report 

select sd.name "Service Name", rtl.templatename "Service Template Name", rtl.comments "Template description", rtf.description "Description field" , ttd.templatename "Task Name",ttd.title "Task Title",std .statusname "Task Status"
from requesttemplate_list rtl 
LEFT JOIN requesttemplate_fields rtf ON rtl.templateid=rtf.templateid 
LEFT JOIN Categorydefinition cd ON rtf.categoryid=cd.categoryid LEFT JOIN subcategorydefinition scd ON rtf.subcategoryid=scd.subcategoryid 
LEFT JOIN itemdefinition id ON rtf.itemid=id.itemid 
LEFT JOIN Servicedefinition sd ON rtl.parent_Service=sd.serviceid 
left join requesttasktemplate rtt on rtl.templateid=rtt.reqtemplateid
left join tasktemplatedetails ttd on ttd.templateid=rtt.templateid
left join statusdefinition std on std.statusid=ttd.statusid
where is_catalog_template='true' AND rtl.isdeleted='false' ORDER BY 2

                  New to ADSelfService Plus?