Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira + Python : Issue while categorize the issues based on issue type.

Sunesh M S September 8, 2018

 

Hi All,

The below highlighted conditions are not working as expected. 

for Issue in jira.search_issues('project=YKP and assignee='+ Assignee +
' and status not in ("Done", "Released", "Discarded") ORDER BY issuekey, issuetype'):
if (Issue.fields.issuetype == 'Epic'):
print(Issue.fields.issuetype)
print("---" + '{} | {} | {} | {}'.format(Issue.key,Issue.fields.issuetype, Issue.fields.summary, Issue.fields.status))
if (Issue.fields.issuetype=='Story'):
print(Issue.fields.issuetype)
print("---" + '{} | {} | {} | {}'.format(Issue.key, Issue.fields.issuetype, Issue.fields.summary, Issue.fields.status))

 

I have tried all the combinations like below,

if (Issue.fields.issuetype == 'Epic'):

if (Issue.fields.issuetype == "Epic"):

if (Issue.fields.issuetype in ['Epic']):

Could you please help me to sort out the issue?

 

Thanks in Advance,

Maadi.

 

1 answer

1 accepted

1 vote
Answer accepted
Mohamed Benziane
Community Champion
September 9, 2018 edited

Hello Sunesh,

 

The datatype of issuetype is 'class 'jira.resources.IssueType' and you value 'Epic' is string so you have to convert you  issuetype class into a string.


if str(i.fields.issuetype)=='Story':
'your code'

Feel free to place print instructions like this 'print (type<your variable or anything else') to know the datatype and if you need to convert something.

 

Sorry for my english is not my native language

Hope it help 

Sunesh M S September 9, 2018

Thanks a lot @Mohamed Benziane. That's worked.

Mohamed Benziane
Community Champion
September 9, 2018

you're welcome, i'm glad i helped you.

 

Feel free to tag your question as solved may be it will help other people.

Sunesh M S September 9, 2018

[Solved]

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team '25 europe, atlassian event, barcelona 2025, jira, confluence, atlassian intelligence, rovo, ai-powered collaboration, developer tools, agile teams, digital transformation, teamwork solutions, atlassian conference, product announcements

🌆 Team '25 Europe registration is now open!

Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.

Register now
AUG Leaders

Atlassian Community Events