How to find the Request Type associated to a Jira issue using SQL query
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
To identify the Request Type of a specific issue using SQL query.
Solution
Note the project key, issue ID and the ID of 'Customer Request Type' custom field. To retrieve those info refer to the following KBs:
Run the following query in the database:
1 2 3 4 5 6 7
SELECT "NAME" FROM "AO_54307E_VIEWPORTFORM" WHERE "KEY" LIKE ( SELECT TRIM('<lowercase_pkey>/' FROM stringvalue) FROM customfieldvalue WHERE customfield = <cf_ID> AND issue = <issue_ID>);
ℹ️Replace
<lowercase_pkey>
,<cf_ID>
, and<issue_ID>
respectivelyFor example:
1 2 3 4 5 6 7
SELECT "NAME" FROM "AO_54307E_VIEWPORTFORM" WHERE "KEY" LIKE ( SELECT TRIM('itsm/' FROM stringvalue) FROM customfieldvalue WHERE customfield = 10115 AND issue = 10041);
⚠️ This query is tested on PostgreSQL. If you have a different database, please adapt the syntax accordingly.
Below query can also be used to get all Projects and their associated Request Types along with the requesttypekey
1
SELECT p.pname, r."NAME" as request_type_name , (po."KEY" || '/' || r."KEY") AS request_type_key
FROM "AO_54307E_VIEWPORT" po, "AO_54307E_VIEWPORTFORM" r, project p
WHERE po."ID"=r."VIEWPORT_ID" AND po."PROJECT_ID"=p.id
Was this helpful?