I'm using the python REST API for Jira to create new issues in Jira (next gen). I am able to do so using bare bones commands:
issue_dict = {
'project': 'AT',
'summary': 'Testing custom field',
'description': 'Look into this one',
'issuetype': 'Test Issue'
}
issue = jira.create_issue(fields=issue_dict)
However, when I try to create a new issue while providing a value for a custom field, I get an error. I have already created this custom field in my Jira instance by dragging the "short text" option to the "context fields" section under Project Settings > issue types. Code and error below:
issue_dict = {
'project': 'AT',
'summary': 'Testing custom field',
'description': 'Look into this one',
'issuetype': 'Test Issue',
'Species': 'Homo sapiens'
}
issue = jira.create_issue(fields=issue_dict)
My understanding is that custom fields work differently between classic and next-gen Jira and most of the queries I see online with regards to this refer to classic Jira. Does anyone have any advice regarding this issue? Thanks!
I found a solution that worked for me. Instead of providing the name of the custom field, I looked for the custom field id based on this: https://community.atlassian.com/t5/Jira-Software-questions/Project-ID-and-Custom-Field-ID-on-next-gen-project/qaq-p/1095295. Specifically, I went to the link below and looked for the some id associated with the custom field of interest.
https://your-domain.atlassian.net/rest/api/3/field
So my code looked something like this:
issue_dict = {
'project': 'AT',
'summary': 'Testing custom field',
'description': 'Look into this one',
'issuetype': 'Test Issue',
'customfield_10027': 'Homo sapiens'
}
issue = jira.create_issue(fields=issue_dict)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.