Query to fetch the fields in the templates (MSSQL & PGSQL)

Query to fetch the fields in the templates (MSSQL & PGSQL)

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

The query fetches all the fields with display name used across Request templates

PQSQL:


select Distinct  (CASE when fc.field_name like 'udf_%' then ca.aliasname else fc.field_name END) "Fields", rt.templatename "Template name" , sd.name "Service Catalog Name", (CASE when rt.is_catalog_template='true' then 'Service Template' else 'Incident Template' END) "Template Type" from requesttemplate_list rt
left join servicedefinition sd on sd.serviceid = rt.parent_service
left join form_customizer fc on fc.form_name = ('WorkOrder_' ||  rt.templatename)
left join columnaliases ca on fc.field_name like ('udf_%_' || ca.columnaliasesid)
where rt.templatename not like 'Default Service Item'
order by 2



MSSQL:


select  Distinct (CASE when fc.field_name like 'udf_%' then ca.aliasname else fc.field_name END) "Fields", rt.templatename "Template name" , sd.name "Service Catalog Name", (CASE when rt.is_catalog_template='true' then 'Service Template' else 'Incident Template' END) "Template Type" from requesttemplate_list rt
left join servicedefinition sd on sd.serviceid = rt.parent_service
left join form_customizer fc on fc.form_name = ('WorkOrder_' +  rt.templatename)
left join columnaliases ca on fc.field_name like ('udf_%_' + cast(ca.columnaliasesid as varchar))
where rt.templatename not like 'Default Service Item'
order by 2

                  New to ADManager Plus?

                    New to ADSelfService Plus?