Forums

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

Python Script giving Attribute error when extracting issue information

Pranay Verma
Contributor
September 8, 2019

Hi,

I'm basically extracting some fields from the issues in my project. So far I din't have any problem extracting the summary and description fields. But I'm unable to extract the fields from any other attribute. For example, I've used the following code, and I want to put the contents in the TechNowId field in the list. I've attached the code and the snap of the board as well as the console output :

key_list = []
summary_list = []
description_list = []
tn_id_list = []

for issue in issues_in_backlog:
description_list.append(issue.fields.description)
summary_list.append(issue.fields.summary)
tn_id_list.append(issue.fields.TechnowId)

for summary in summary_list:
ws.cell(row = summary_row, column = start_column).value = summary
summary_row += 1

for description in description_list:
ws.cell(row = description_row, column = start_column+1).value = description
description_row += 1

for TechnowId in tn_id_list:
ws.cell(row = tn_id_row, column = start_column+2).value = TechnowId
tn_id_row += 1


Could someone help me with this????
Capture1.PNGCapture2.PNG

1 answer

1 accepted

1 vote
Answer accepted
DPKJ
Community Champion
September 8, 2019

@Pranay VermaAPI return value of custom field by custom-field id not by custom-field name.

Find ID of TechnoWorld field and use that. It will in format like 'customfield_xxxxx' where xxxx is number.

Pranay Verma
Contributor
September 8, 2019

How can I find the id for that field?

DPKJ
Community Champion
September 9, 2019

You can do that by basically look at api response or on admin page of Jira.

This KB article describe this in detail - https://confluence.atlassian.com/jirakb/how-to-find-id-for-custom-field-s-744522503.html

Like Pranay Verma likes this
Pranay Verma
Contributor
September 9, 2019

Hi @DPKJ ,

I got the field name from the advanced search and used it as issue.fields.customfield_xxxxx, in the code, and it worked like a charm. Thanks a lot!!

Thanks And Regards,

Pranay

DPKJ
Community Champion
September 9, 2019

You are welcome @Pranay Verma 

Like Pranay Verma likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events