Forums

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

How to get all item.field from jira_issues using Python API

Marcelo Cornes Lucas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 10, 2022 edited

Hi I am using this code to extract all issues from Jira

 for issue in jira_issues:

        try:

            for history in issue.changelog.histories:

                for item in history.items:

                       d = {

                            'id':                        issue.id,

                            'keyId':                 issue.key,

                            'Total_change':  issue.changelog.total,

                            'Ticket_created':  str(issue.fields.created)[:23],

                            'Proj_id':              issue.fields.project.id,

                            'Proj_name':       issue.fields.project.name,

                            'Proj_key':           issue.fields.project.key,

                            'Status_name':   issue.fields.status.name,

                            'Status_cat':       issue.fields.status.statusCategory.key,

                            'Status_col':       issue.fields.status.statusCategory.colorName,

                            'Author':              history.author,

                            'Issue_type':       issue.fields.issuetype.name,

                            'Last_update':    str(issue.fields.updated)[:23],

                            'Timestamp':      str(history.created)[:23],

                            'FldName':          item.field,

                            'From_':               item.fromString,

                            'To_':                    item.toString

                            }

              if d.keys():

                    issues = issues.append(d, ignore_index=True)

If the item has only one item.field the code is correct, but with multiple item.fields (status, time spent, assignee) the code is wrong because it is taking only the first one.

What can I do to get all item.fields instead only the first one?

2 answers

1 accepted

0 votes
Answer accepted
Yuliia_Borivets_[SaaSJet]
Atlassian Partner
June 10, 2022

Hi @Marcelo Cornes Lucas 

Do you need to export the history of changes for all issue fields? I'm not strong in coding, but I can suggest an alternative solution if you don't mind.

You can try exporting history with Issue History for Jira app. It takes a few clicks to do.

Export issue history (2).png

The app is developed by my team. There is a 30-days free trial, so you can check if it meets your needs.

Marcelo Cornes Lucas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 10, 2022

Hi @Yuliia_Borivets_[SaaSJet]  

Yes, every day we run a python script to load daily data from jira as part of an ETL process.

The final goal is to show historical data in a dashboard using Qlik Sense.

Thanks for the answer

0 votes
Dmytro Kvashenko _DOIT-BI_
Contributor
June 10, 2022

Hi @Marcelo Cornes Lucas ,

You can use Qlik Sense & Qlik View Connector for Jira https://marketplace.atlassian.com/apps/1225600/qlik-sense-qlik-view-connector-for-jira?hosting=cloud&tab=overview
This will save you a lot of hard work.
You can ask questions by writing to support@doit-bi.com

Best regards,
Demi Kont

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events