Script or feature to highlight used custom fields

Rumceisz May 31, 2012

Hi All,

I would like to ask you for help which would be spare a lot of time for us.

Cover story:

we are migrating many Jira instances week by week to our master Jira. The problem is that all the projects in the most old Jira instances use more than 100 custom fields: and there a plenty of custom fields that are used by only 1 projects. This would be not so big problem but there are more than 70 global custom fields, about which we cannot tell that a particular project whether use the custom field or not.

Most of the time when we ask the users of a to be migrating projects that what are the custom fields they need in the new instance they tell e.g. 15 custom fields. But when it's migrating, we get the surprise that the project cannot be migrated because 22 custom fields do not exist in the new Jira.

The reverse is also used to happen: when we create a custom field for a migrated project but it was never used in the old Jira.

So we really need a tool or script which we could run and result the custom fields that have existing values in a particular project.

Thanks in advance!

(sorry for the too much text)

4 answers

1 accepted

1 vote
Answer accepted
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012

You can probablt find it in the UI itself using JQL.

customfield is not empty and project = "ABC"

where customfield is the customfield you want to search.

Rumceisz June 3, 2012

Hi Jobin,

I never used UI before. Is there a jelly script for that too?

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 3, 2012

By UI, I meant the JIRA User Interface. Surely you have used it?

https://confluence.atlassian.com/display/JIRA/Advanced+Searching

Rumceisz June 3, 2012

Hi Jobin,

of course I used! Sorry I misunderstood:)

Well the problem is that this would be very cumbersome hence we use about 70 global custom fields. So we should write all the custom fields into the advanced search field.

1 vote
Andrei [errno]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 30, 2013

got help from the legendary Atlassian support :) thanks guys!
extremely useful if your JIRA admins do not have permissions to access some projects:

select CF.cfname, P.pname, count(*) as issues from project P
join jiraissue I on P.id = I.project
join customfieldvalue CFV on I.id = CFV.issue
join customfield CF on CFV.customfield = CF.id
where CF.cfname = 'Epic Status'
group by CF.cfname,P.pname

should work for PostgreSQL

0 votes
Dieter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2012
If you can run SQL scripts against the Jira database you could do this to get the customfields in project with id your_project_id
select distinct(customfield.cfname) from customfieldvalue.customfield where customfieldvalue.project = your_project_id and customfield.id = customfieldvalue.customfield
This should work for MySQL databases but not sure for others
Rumceisz June 6, 2012

Hi Dieter,

this script will get a list of used custom fields? Because if I have to put all the custom fields one by one in the select, it would be the same as I use the advenced search function.

Dieter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2012
Yes, it gets all the custom fields used in project with id your_project_id
Rumceisz June 7, 2012

Dieter,

thank you!

Rumceisz June 7, 2012

Hi Dieter,

I just consider that the customfield doesn't have project field! So it doesn't work.

customfieldvalue.project = your_project_id

Dieter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2012
Sorrry, i need to correct that, i mixed the project id up with the issue id. Happens to me all the time ;)

select distinct(customfield.cfname) from customfieldvalue, customfield, jiraissue where customfieldvalue.issue=jiraissue.id and jiraissue.project = your_project_id and customfieldvalue.customfield = customfield.id

0 votes
Rumceisz June 6, 2012

Any idea from somebody?

Suggest an answer

Log in or Sign up to answer