Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to get a list of custom fields displayed on a screen based on issue type?

Dayna Eidle
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 12, 2018

I am trying to write a SQL query to produce a list of custom fields for a project (by issue type) that are displayed on the View Issue screens for each field screen scheme. I can't quite figure out how to join the tables to produce the correct result. The query I've been working with is this:

select distinct p.pname, fss.name, it.pname, cf.id, cf.cfname
from jiraschema.project p inner join jiraschema.nodeassociation na on p.id = na.source_node_id and na.association_type = 'ProjectScheme'
inner join jiraschema.issuetypescreenscheme itss on na.sink_node_id = cast(itss.id as nvarchar)
inner join jiraschema.issuetypescreenschemeentity itsse on itss.id = itsse.scheme
inner join jiraschema.fieldscreenscheme fss on itsse.fieldscreenscheme = fss.id
inner join jiraschema.fieldscreenschemeitem fssi on fss.id = fssi.fieldscreenscheme
inner join jiraschema.fieldscreen fs on fssi.fieldscreen = fs.id
inner join jiraschema.fieldscreentab fst on fs.id = fst.fieldscreen
inner join jiraschema.fieldscreenlayoutitem fsli on fst.id = fsli.fieldscreentab
inner join jiraschema.customfield cf on fsli.fieldidentifier = 'customfield_' + cast(cf.id as nvarchar)
inner join jiraschema.jiraissue ji on p.id = ji.project
inner join jiraschema.issuetype it on ji.issuetype = it.id
where fssi.operation = 2

 

(I know all the joins don't make this look very good)

I know that this isn't producing a correct result because it's listing more than one issue type for a field screen scheme that I know for a fact only has one issue type. 

Is there a way to join the tables correctly or a different query that would give the right result of custom fields displayed on view issue screens by issue type?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events