How to get all Issue-IDs with a particular custom field filled?

As we re going to update an external system with the according JIRA key (and afterwards get the vice-versa update updating the JIRA issues) we have to get a list with all issues which have a value for

select * from customfield where CFNAME = 'HP OpenView Type' OR CFNAME ='HP OpenView ID';

The export should contains these both CFNAME fields (combined primary key) and the according JIRA issue ID.

The final query will directly run against the JIRA DB, the import job from external will be done manually first.

4 answers

1 accepted

This widget could not be displayed.
SELECT   p.pkey || '-' || ji.issuenum "JIRA-Key", CV.*
    FROM jiraissue ji,
         (SELECT nvl(cv1.issue,cv2.issue) AS "ISSUE", cv1.stringvalue AS "HP_OpenView_Type", cv2.numbervalue AS "HP_OpenView_ID"
            FROM (SELECT *
                    FROM customfieldvalue
                   WHERE customfield = 11602) cv1
                 inner JOIN
                 (SELECT *
                    FROM customfieldvalue
                   WHERE customfield = 11601) cv2 ON cv1.issue = cv2.issue
                 ) CV,
         project p
   WHERE ji.ID = CV.issue AND ji.project = p.ID

This widget could not be displayed.

The customfieldvalue table holds the values for a certain issue (you have FK on issue and the custom fields from the SELECT you mentioned), so you can query that.

This widget could not be displayed.

You need to be reading customfieldvalue for the data value. That table has all of the custom field data, so you will need to limit the selection with the issue id(s) (from reading jiraissue), and the custom field id(s), which you get from your SQL already posted.

When you are writing data from external to Jira, remember that you can NOT do it with SQL.

This widget could not be displayed.

Hi all,

thanks for your reply!
Meanwhile i found the db scheme where i tried to create an according query. As soon as we got some results i ll post it here...

Thanks & regards,

Hans-Hermann

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

220 views 3 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you