How to find which fields are in use in a project for a particular issuetype

Atifa Fahmeen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 14, 2020

Iam creating issue by JiraRestClient in java. Iam able to set default fields from my code. I was also trying to set the priority of issue while creating the issue. But the field priority was not present in the context field list which resulted in this error and the issue was not created.

[ErrorCollection{status=400, errors={priority=Field 'priority' cannot be set. It is not on the appropriate screen, or unknown.}, errorMessages=[]}]

Is there a way to find out which fields are in use for an issueType(Im trying for issueType Task) in a particular project.

The way I can retrieve the issueTypes available for a project, I want to retrieve the fields which can be set. Im using this code to get the issuetypes:

 

JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
client = factory.createWithBasicHttpAuthentication(uri, task.getUsername(), task.getPassword());

IssueType issueType = null;
Iterator<IssueType> issueTypeItr = null;
issueTypeItr = client.getProjectClient().getProject(task.getIssueTrackerProjectName()).claim().getIssueTypes().iterator();
while (issueTypeItr.hasNext()) {
IssueType it = issueTypeItr.next();
if (it.getName().equalsIgnoreCase(task.getIssueTrackerIssueType())) {
issueType = it;
}
}

 

Similarly, how can we get the fields which are present in the list of fields

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 25, 2020

Hi @Atifa Fahmeen -- Welcome to the Atlassian community!

I believe this will return the issue types and their attributes.  Substitute your company's URL and project name.

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

Please look here for more information:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/

 

Best regards,

Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events