Hello ,
Im fairly new to groovy script and the jira api
im trying to write a script to return all custom field that are on 0 screens .
any ideas how to do so? or which classes / methods are relevant for this?
any help will be greatly appreciated.
Hi Yotam
if this is just a one off task, then the custom fields page will show the screens used column. Although just because a field is not on a screen doesn’t mean it isn’t in use in a script or workflow.
Hi,
I know i can find fields with no screen on the custom fields page but with 1500+ fields this means a lot of manual work,of which I'm trying to avoid.
and also its a task I need to do on a monthly basis.
are you able to run SQL in the JIRA db?
this MySQL query should show screens used by fields and count of custom values present or nulls if unused
SELECT DISTINCT cf.id, cf.cfname AS field, cfu.screenname, cfu.tabname, fvals.num_valuesFROM customfield cf LEFT JOIN (SELECT cfi.id, cfi.cfname, fs.name AS screenname, fst.name AS tabname, fsli.fieldidentifier AS fieldid FROM fieldscreen fs, fieldscreenlayoutitem fsli, fieldscreentab fst, customfield cfi WHERE fst.fieldscreen = fs.id AND fsli.fieldscreentab = fst.id AND REPLACE(fsli.fieldidentifier, 'customfield_', '') = cfi.id) cfu ON cf.id = cfu.id LEFT JOIN (SELECT customfield, COUNT(*) AS num_values FROM customfieldvalue GROUP BY customfield) fvals ON cf.id = fvals.customfield
Hi
thanks for the answer, its useful for different stuff but still need to be able to find custom fields that have 0 screens , this data obviously exists somewhere in the database but I can't find a way to query it.
if you have any suggestions on how to do that , I will be forever grateful.
Thanks anyway!
It looks like you're new here. Sign in or register to get started.