1

When using the jira python library and creating issues, non mandatory fields are being enforced on create_issue call.

Response on create issue attempt:

text: No issue link type with name 'Automated' found.

Response on create meta call to check mandatory fields:

'hasDefaultValue': False, u'key': u'issuelinks', u'name': u'Linked Issues', u'operations': [u'add'], u'required': False,

Pablo Velasquez
  • 111
  • 1
  • 1
  • 5

2 Answers2

0

I had a similar issue and after a bit of digging around, this is what I did. Open a jira and using developer tools (F12), find out the id of the mandatory custom fields. They should be named somewhat like "customfield_10304"

Once you have these field ids, just use them the way you set other fields while creating an issue. For eg.

new_issue = jira.create_issue(project={'key': project},
                                  summary='{}'.format(summary),
                                  description='{}'.format(description),
                                  issuetype={'name': 'Bug'},
                                  labels=labels,
                                  versions=[{"name": affect_version[0]}],
                                  customfield_10304=[{"value": env}],
                                  customfield_10306=[{"value": customer}],
                                  priority={'name': priority})
anish
  • 88
  • 6
0

Jira behaves strange many times. createmeta call returns you all the possible issuetypes, and their all fields, and which field is mandatory or not.

But even after this, there are certain fields which are mandatory but createmeta wont tell you this. You need to rely on the exception message that you got after filing create_issue().

In the exception message, exception_obj.response.text gives you the json having key/value of exact field required.

Then, you can search in response of createmeta about its schema type, and may be the allowedValues set. And, then try again.

Basically, you need to do retry of above mechanism.

Gorav Singal
  • 508
  • 3
  • 11