Forums

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

Jira python and custom field

Christophe CHAUVIN
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!
January 9, 2018 edited

hello 

I want to get only the Sprint's name of an issue using jira-python

when I Type

issue.fields.customfield_10006

the answer I get is 

['com.atlassian.greenhopper.service.sprint.Sprint@2119aef0[id=111,rapidViewId=14,state=FUTURE,name=Sprint 18-S08,goal=,startDate=<null>,endDate=<null>,completeDate=<null>,sequence=111]']


How can I just get 'Sprint 18-S08' ?

I tried issue.fields.customfield_10006.name but it doesn't work

 

2 answers

1 accepted

1 vote
Answer accepted
Shaun S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2018

Hi Christophe,

 

I was able to accomplish this with a bit of regex that filters out the extra data. Hope this helps.

 

issues_in_project = jira.search_issues('project=ALPHA AND SPRINT not in closedSprints() AND sprint not in futureSprints()')


for value in issues_in_project:
for sprint in value.fields.customfield_10006:
sprint_name = re.findall(r"name=[^,]*", str(value.fields.customfield_10006[0]))
print sprint_name
0 votes
Jack Nolddor _Sweet Bananas_
Contributor
January 9, 2018

Does issue.fields.customfield_10006['name'] work?

Christophe CHAUVIN
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!
January 10, 2018

no :-(  it doesn't

neither issue.fields.customfield_10006[x]

Like • Mark Gancsos likes this
Mark Gancsos
Contributor
March 14, 2019

Did you ever get this working?

Like • Alyssa Snow likes this
Martin Rodriguez December 7, 2021

Hi, you can do the following:

custom=issue.fields.customfield_10006
for x in custom:

    print(x.name)

Suggest an answer

Log in or Sign up to answer