how to find unused custom fields in sql

Sema YILDIRIM May 4, 2021

I would like to list custom fields in "CustomFieldValue or customfieldoption" fields where no new "value" has been entered in the last year. I want to list customfileds that are not used in Jira with sql.

2 answers

0 votes
Sagar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 4, 2021

Hi @Sema YILDIRIM You can refer the below document from Atlassian to find the custom field usage in Jira.

https://confluence.atlassian.com/enterprise/managing-custom-fields-in-jira-effectively-945523781.html#

Let me know in case of any issues.

Sema YILDIRIM May 4, 2021

Thank you , The result I got with changegroup is not correct, since the filled custom field information does not appear in history while creating the issue.

0 votes
KAGITHALA BABU ANVESH
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 4, 2021

Hello @Sema YILDIRIM ,

 

I found this article from Atlassian documentation.https://confluence.atlassian.com/enterprise/managing-custom-fields-in-jira-effectively-945523781.html 

Please have a look.

I don't have access to run these. Please let us know after your query.

 

Thanks,

Anvesh

Sema YILDIRIM May 4, 2021

Hi,

 

Thank you :) But It brings wrong custom field information I created with "ScriptRunner"

Sagar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 4, 2021

Hi @Sema YILDIRIM You can try the below SQL and AFAIK if the custom fields are coming from any external plugin results will not be reliable but still give it  try

select c.id Field_ID, c.cfname Field_Name, date_format(l.last_used, '%m/%d/%y') last_used, u.Records current_usage from customfield c LEFT JOIN (select h.field, cg.CREATED last_used FROM changegroup cg, (select field, max(groupid) max from changeitem group by field) h where cg.id = max) l ON c.cfname = l.field LEFT JOIN (select c.cfname, count(v.id) as Records from customfield c LEFT JOIN customfieldvalue v ON c.id = v.customfield group by c.cfname) u ON c.cfname = u.cfname ORDER BY u.Records ASC;
Sema YILDIRIM May 6, 2021

The result I got with changegroup is not correct, since the filled custom field information does not appear in history while creating the issue.

Suggest an answer

Log in or Sign up to answer