How to list all fields and screens in use by a Project in Jira

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

 

要約

As a Jira Admin, you may want to know all fields in use by a Project — or list all Projects and their respective fields.

This is particularly useful when carrying out clean-up routines in Jira, like assessing the impact of deleting certain custom fields in Jira.

You may also be interested in listing Projects and Field Configurations by Issue Types.


環境

All versions of Jira Software Data Center and Server (not Cloud).

All versions of Jira Service Management Data Center and Server (not Cloud).


ソリューション

Fields configured in Screen Schemes and Workflow Schemes (DB)

Jira doesn't provide a UI (user interface) for such report, so we have to query the database directly:

Postgres example
WITH fields_from_screenschemes AS (
	select distinct p.id as "Project Id", p.pkey as "Project Key", fsli.fieldidentifier as "Field Identifier", coalesce(cf.cfname, fsli.fieldidentifier) as "Custom Field Name", fs.name as "Screen Name", coalesce(it.pname, 'DEFAULT') as "Issue Type", itss.name as "Scheme Name"
	from project p
	join nodeassociation na on na.source_node_id = p.id and na.sink_node_entity = 'IssueTypeScreenScheme'
	join issuetypescreenscheme itss on itss.id = na.sink_node_id
	join issuetypescreenschemeentity itsse on itsse.scheme = itss.id
	join fieldscreenscheme fss on fss.id = itsse.fieldscreenscheme
	join fieldscreenschemeitem fssi on fssi.fieldscreenscheme = fss.id
	join fieldscreen fs on fs.id = fssi.fieldscreen
	join fieldscreentab fst on fst.fieldscreen = fs.id
	join fieldscreenlayoutitem fsli on fsli.fieldscreentab = fst.id
	left join customfield cf on concat('customfield_', cf.id) = fsli.fieldidentifier
	left join issuetype it on it.id = itsse.issuetype
	where 1=1
		--and p.pkey in ('A', 'B', 'C')
		--and fsli.fieldidentifier = 'customfield_123' and cf.id = 123
	),
	fields_from_workflows AS (
	select distinct p.id as "Project Id", p.pkey as "Project Key", fsli.fieldidentifier as "Field Identifier", coalesce(cf.cfname, fsli.fieldidentifier) as "Custom Field Name", fs.name as "Screen Name", coalesce(it.pname, 'DEFAULT') as "Issue Type", wfs.name as "Scheme Name"
	from project p
	join nodeassociation na on na.source_node_id = p.id and na.sink_node_entity = 'WorkflowScheme'
	join workflowscheme wfs on wfs.id = na.sink_node_id
	join workflowschemeentity wfse on wfse.scheme = wfs.id
	join jiraworkflows wf on wf.workflowname = wfse.workflow
	join fieldscreen fs on wf.descriptor like concat('%<meta name="jira.fieldscreen.id">', fs.id, '</meta>%')
	join fieldscreentab fst on fst.fieldscreen = fs.id
	join fieldscreenlayoutitem fsli on fsli.fieldscreentab = fst.id
	left join customfield cf on concat('customfield_', cf.id) = fsli.fieldidentifier
	left join issuetype it on it.id = wfse.issuetype
	where 1=1
		--and p.pkey in ('A', 'B', 'C')
		--and fsli.fieldidentifier = 'customfield_123' and cf.id = 123
	)
SELECT s."Project Id", s."Project Key", s."Field Identifier", s."Custom Field Name", s."Screen Name", s."Issue Type", 'Screen Scheme' as "Source", s."Scheme Name"
from fields_from_screenschemes s
union
SELECT w."Project Id", w."Project Key", w."Field Identifier", w."Custom Field Name", w."Screen Name", w."Issue Type", 'Workflow Scheme' as "Source", w."Scheme Name"
from fields_from_workflows w
order by 5, 2;

The query above is an example based off Postgres syntax and lists all fields configured either in Screen Schemes or Workflow schemes.

You may uncomment and edit lines 15, 16, 31 and 32 to filter by specific Projects and/or Custom Fields.


This is an example output:

 Project Id | Project Key | Field Identifier  | Custom Field Name |             Screen Name             | Issue Type |     Source      |                 Scheme Name                 
------------+-------------+-------------------+-------------------+-------------------------------------+------------+-----------------+---------------------------------------------
 10100      | KANBAN      | description       | description       | KANBAN: Kanban Bug Screen           | Bug        | Screen Scheme   | KANBAN: Kanban Issue Type Screen Scheme
 10100      | KANBAN      | customfield_10600 | Field 3           | KANBAN: Kanban Bug Screen           | Bug        | Screen Scheme   | KANBAN: Kanban Issue Type Screen Scheme
 10100      | KANBAN      | reporter          | reporter          | KANBAN: Kanban Bug Screen           | Bug        | Screen Scheme   | KANBAN: Kanban Issue Type Screen Scheme
 10100      | KANBAN      | customfield_10600 | Field 3           | Workflow Screen                     | DEFAULT    | Workflow Scheme | KANBAN: Software Simplified Workflow Scheme
 10100      | KANBAN      | customfield_10500 | Some Field        | Workflow Screen                     | DEFAULT    | Workflow Scheme | KANBAN: Software Simplified Workflow Scheme
 10100      | KANBAN      | assignee          | assignee          | Workflow Screen                     | DEFAULT    | Workflow Scheme | KANBAN: Software Simplified Workflow Scheme 

It shows each field, the associated screen and whether it's configured in a Screen Scheme or Workflow Scheme.

  • Screen Scheme means the field's used by the project for viewing, editing or creating issues
  • Workflow Scheme means the field's configured in some workflow transition


Fields configured at issue creation (REST API)

Though Jira's REST API you may list all fields available at issue creation.

First, query the Project for it's issuetypes:

GET <Jira URL>/rest/api/2/issue/createmeta/<project Key or Id>/issuetypes

Then, for the issuetypes you need the fields available during creation, pass the issue type Id at the end:

GET <Jira URL>/rest/api/2/issue/createmeta/<project Key or Id>/issuetypes/<issue type Id>

最終更新日: 2023 年 10 月 17 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.