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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to Find Unused Custom Fields in Jira Cloud Using REST API in Python

Algorithm:

  1. Get all custom fields (CFs), using HTTP GET <server>/rest/api/3/field/search
  2. You need to get the CF's screens and contexts, so the query string would is:  
    'type=custom&orderBy=name&expand=screensCount,contextsCount'
  3. Build a dict of all unused CFs (dict key is ID, since custom field names are not unique)
  4. A CF is considered unused if its screen count == 0 or context count == 0
  5. In the returned JSON for a CF, there are keys 'screenCount' and 'contextCount'. If a key is not present, it means that the count is 0.

Notes:

  1. You'll need to generate an API token to use the REST API
  2. The above REST API endpoint returns paginated data, so you will need to iterate on the results, using the total,  startAt and maxResults, as explained here:
    1. https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#expansion
  3. Note that in most cases, the context count (CC) is 1 and it actually means that it's the 'global' context (meaning that the CF can be used in any project, any issue type).
    1. That does not necessarily mean that the CF is actually used. However, if CC==0, it does mean that the CF is unused.

 

1 comment

Daniel Ebers
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 29, 2022

Hi @Amir Katz (Outseer)
thanks for the great article - we use it meanwhile regularly.

While I totally agree for the part of the contexts...

Note that in most cases, the context count (CC) is 1 and it actually means that it's the 'global' context (meaning that the CF can be used in any project, any issue type).

  1. That does not necessarily mean that the CF is actually used. However, if CC==0, it does mean that the CF is unused.

... we found that having a field not on any screen could be a misleading signal. Sometimes we found admins removed it temporarily from screens but the field is still holding values for at least one issue.
We feel some kind of double checking is something useful to do - in order not to delete any data which would be considered still needed.

Regards,
Daniel

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events