Is there a way to determine to whcih project a custom field belongs to?

Let's say I have 2 projects, p1 and p2.  The create issue screen for each project has customfield_1  and customfield_2 respectively.

 

GET api/2/filed returns all fields.

 

Am I correct in thinking that all fields are returned but there is no information to identify to which project the custom fields belong to?

 

To get around this, one way would be to prefix the custom field name with a project identifier when creating it?

 

3 answers

2 votes
Steven Behnke Community Champion Nov 02, 2017

Please don't do that. I have been paid professionally to clean up configurations like that. If you scale that sort of configuration out Jira will become very difficult to search and use.

Custom Fields are NOT for projects. You are thinking about it wrong. Custom Fields are more or less global. Use the createMeta and editMeta REST endpoints to discover which fields are in-use by a project. Using the Custom Field name is not a good idea.

0 votes
Alexey Matveev Community Champion Nov 02, 2017

Hello, 

You need to use the following rest function 

rest/api/2/issue/createmeta?projectKeys=QA&expand=projects.issuetypes.fields

But it does not tell you which fields are on the screen. It will just tell you what fields are defined for the project in the layout scheme.  

Thanks for replies.  I was thinking about this on the way home last night and came to the conclusion that custom fields are "global" to JIRA and by adding them to project screens (e.g. issue create) , they become available for use when creating an issue in the project.

 

Our application will need to create a custom field, then add it to a particular  screen for a project.  We need to associate the custom field id to a particular parameter in our projects.

 

The body from the results of a search, converted to a String, will need the "customfield_xxxxx" replaced by our parameter name in order to use Jackson objectmapper - since we cannot define the properties in the class they are unknown until they are created.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

74 views 0 3
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you