Atlassian JIRA+MS SQL Server: Get selected custom field value for Issue from JIRA Database in SQL

Problem

A selected custom field value, that is in a MS SQL Server JIRA Database should be retrieved.

Ansatz – Approach

The tables project_key, jiraissue, CustomFieldValue, customfield and customfieldoption have to be joined

Lösung – Solution

SELECT pk.PROJECT_KEY+'-'+CAST(a.issuenum AS varchar(max)) as issue, c.cfname as field, d.customvalue 
FROM project_key pk
INNER JOIN jiraissue a ON pk.PROJECT_ID=a.PROJECT 
INNER JOIN CustomFieldValue b ON a.ID=b.ISSUE
INNER JOIN customfield c ON b.CUSTOMFIELD=c.id 
INNER JOIN customfieldoption d ON c.id=d.CUSTOMFIELD 
WHERE c.CFName = 'Requirements/Specifications affected?' 
AND   b.STRINGVALUE=CAST(d.id as varchar(max))

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.