You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
I am running a Datacenter instance (8.20.14) and I need to perform an audit on all unused custom fields (and we have a large amount).
I have used the Jira tool "Custom Fields Optimizer" to a list of all custom fields within a project but unfortunately, this tool does not allow an export of all custom fields to a CSV file so I can manipulate it.
Is there a way via either Scriptrunner or the API I can get this list on Datacenter?
Hi @Alex Hutchinson Check this doc for managing custom fields :- https://confluence.atlassian.com/enterprise/managing-custom-fields-in-jira-effectively-945523781.html
OR you can run the following script in Script Console to get a list of empty custom fields :-
import com.atlassian.jira.component.ComponentAccessor
import groovy.sql.Sql
import org.ofbiz.core.entity.ConnectionFactory
import org.ofbiz.core.entity.DelegatorInterface
import java.sql.Connection
def delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface)
String helperName = delegator.getGroupHelperName("default")
def sqlStmt = """
select count(*), customfield.id, customfield.cfname, customfield.description
from customfield left join customfieldvalue on customfield.id = customfieldvalue.customfield
where customfieldvalue.stringvalue is null
and customfieldvalue.numbervalue is null
and customfieldvalue.textvalue is null
and customfieldvalue.datevalue is null
group by customfield.id, customfield.cfname, customfield.description;;
"""
Connection conn = ConnectionFactory.getConnection(helperName)
Sql sql = new Sql(conn)
String result = """
<table>
<tr>
<th>Customfield Name</th>
<th>Customfield Id</th>
</tr>
"""
sql.eachRow(sqlStmt){ it ->
result += """
<tr>
<td>${it.getAt("cfname")}</td>
<td>${it.getAt("id")}</td>
</tr>
"""
}
return result+"</table>"
sql.close()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're Welcome :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.