Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to find unused custom fields in sql

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 Mahajan Community Leader May 04, 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.

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

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

Hi,

 

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

Sagar Mahajan Community Leader May 04, 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;

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
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you