It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Creating an Issue and its custom fields using the JIRA Python Module

I am using the JIRA Python module to automate the process of deleting and creating issues in JIRA. I am trying to create issues in JIRA using a 'for' loop in my python script that uses imported data that I have collected from another database. I need to format the fields when creating the issue so the data I have can align properly with the appropriate fields in JIRA. My Python code is below for creating the issues and storing the data to put into JIRA which is being stored in custom variables:

# Now we create a loop to input the issues from the export.csv CSV file into the fields
# of new issues that are being created in JIRA to replace the old ones that were deleted

exportList = []
with open('C:\\Python27\\scripts\\export.csv', 'r') as f:
re = csv.reader(f)
for row in re:

# Set the column names from the export.csv file equal to variables using the pandas Python module
df = pd.read_csv('C:\\Python27\\scripts\\export.csv')
cqid = df['ClearQuest ID']
summary = df.Summary
datecreated = df['Date Created']
dateresolved = df['Date Resolved']
wistate = df['WI State']
res = df.Resolution
affected = df['Affected version/s']
fixed = df['Fix version/s']
issuetype = df['Issue Type']
priority = df.Priority
description = df.Comments

# Now do the actual loop to create new issues

for row in df:
jira.create_issue(project={'key': 'DEL'}, wistate={'customfield_1001': 'WI State'}, res={'customfield_1001': 'Resolution'}, cqid={'customfield_1001': 'ClearQuest ID'}, datecreated={'customfield_1001': 'Date Created'}, dateresolved={'customfield_1001': 'Date Resolved'}, priority={'customfield_1001': 'Priority'}, fixed={'customfield_1001': 'Fixed Version'}, affected={'customfield_1001': 'Affected Version'}, summary={'customfield_1001': 'Summary'}, description={'customfield_1001': 'Description'}, issuetype={'issuetype': 'Issue Type'})

I get the error:

JIRAError: HTTP 400: "{u'issuetype': u'issue type is required'}"

But even when I change issuetype to a custom field it still gives an error. Please let me know what I am doing wrong when creating the issue and the custom and required fields for the issue! Thanks.

1 answer

If I'm not mistaken, you should be using issuetype={'name': 'Issue Type'})

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published 6 hours ago in Off-topic

Teams behind the teams - Your nominations please!

Teams do amazing things together. We’ve talked about the myth of the lone genius and how everything is actually the result of teamwork. You might be thinking, What about a novelist writing, say, Th...

47 views 0 5
Read article

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