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
Community showcase
Published in Off-topic

Run into these Solution Partners at Atlassian Open

Hey there Community! Atlassian Open is kicking off in less than a month and we can't wait to touch down in Vienna, Sydney and Boston. This is an opportunity to create the future of teamwork with ...

83 views 0 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you